So far as our code and the code of another user, we have passed self as the first argument in the definition of a function/method.
relating code in consumers.py:
from channels.generic.websocket import AsyncWebsocketConsumer
import json
class Trade(AsyncWebsocketConsumer):
async def my_send(self, data):
if isinstance(data, dict):
d = json.dumps(data)
else:
d = str(data)
await self.send(d)
Another user's code:
class TestConsumer(WebsocketConsumer):
def connect(self):