Experimenting with Channels: sending messages from Django shell doesn't work

70 views
Skip to first unread message

Joshua Gardner

unread,
Jan 16, 2017, 7:27:19 AM1/16/17
to Django users
I'm in the process of developing a Websockets notifications system using Channels. I've got a JsonWebsocketConsumer that adds the connection to a group for the Location (model) that the user belongs to. Connecting to that websocket with wscat, and trying to see if sending to that group works, I do Group(location.group_name).send({'text': '"some json"'}) within the Django shell. I am using the Redis channels backend. Even so, nothing is sent to the connected group. I even try sending to the reply_channel of the websocket connection from within the shell, and nothing is sent.

Do channels not work in the Django shell, or is something else possibly broken?

Joshua Gardner

unread,
Jan 16, 2017, 1:00:57 PM1/16/17
to Django users
I'm going to answer my own question:

Appears that I need to use the "immediately" keyword are to Channel or Group.send.

Andrew Godwin

unread,
Jan 16, 2017, 6:23:09 PM1/16/17
to django...@googlegroups.com
Hi Joshua,

This was actually a bug that was fixed in 1.0.2 - were you on an older version? If not, I'd like to make sure the bug didn't somehow reappear!

Andrew

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/164ed019-14c5-4328-ac21-f3935771d520%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages