I\'m trying to make a page which shows live-updating data to the client. The rest of the site is built with Django, so I\'m trying to use Channels for this.
The data I
Add user to django channels Group on ws_connect
from channels.auth import channel_session_user_from_http
from channels import Group
@channel_session_user_from_http
def ws_connect(message, **kwargs):
http_user = message.user
if not http_user.is_anonymous:
message.reply_channel.send({'accept': True})
Group('user-'+str(http_user.id)).add(message.reply_channel)`
send any new updates data to the user by
Group('user-1').send({'text': 'hello user 1'})
Group('user-2').send({'text': 'hello user 2'})