Skip to content
This repository was archived by the owner on Nov 19, 2017. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions chat/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def ws_connect(message):
Group('chat-'+label, channel_layer=message.channel_layer).add(message.reply_channel)

message.channel_session['room'] = room.label
# in order to establish the connection (as of Django 1.10 or so), it must be accepted
# see https://stackoverflow.com/questions/41817871/websocket-using-django-channels
message.reply_channel.send({
'accept': True
})

@channel_session
def ws_receive(message):
Expand Down