As I'm new to websockets, Is it possible to create multiple websocket.receive routes for different consumers with different groups?
app/consumers.py
# First receiver
def ws_receive1(message):
Group(
'Group1',
channel_layer=message.channel_layer
).send({'text': "receiver1"})
def ws_receive2(message):
Group(
'Group2',
channel_layer=message.channel_layer
).send({'text': "receiver2"})
# routing.py
channel_routing = [
route("websocket.connect", consumers.ws_connect1),
route("websocket.disconnect", consumers.ws_disconnect1),
route("websocket.receive", consumers.ws_receive1),
route("websocket.connect", consumers.ws_connect2),
route("websocket.disconnect", consumers.ws_disconnect2),
route("websocket.receive", consumers.ws_receive2),
]
Any advise on it?