mirror of
https://github.com/django/daphne.git
synced 2025-07-01 02:13:12 +03:00
Avoid NameError in example code. (#208)
'room' is used in the Group initialization but was not defined.
This commit is contained in:
parent
f8c1a9c688
commit
0fe9d2be2b
|
@ -571,8 +571,9 @@ have a ChatMessage model with ``message`` and ``room`` fields::
|
||||||
# Connected to chat-messages
|
# Connected to chat-messages
|
||||||
def msg_consumer(message):
|
def msg_consumer(message):
|
||||||
# Save to model
|
# Save to model
|
||||||
|
room = message.content['room']
|
||||||
ChatMessage.objects.create(
|
ChatMessage.objects.create(
|
||||||
room=message.content['room'],
|
room=room,
|
||||||
message=message.content['message'],
|
message=message.content['message'],
|
||||||
)
|
)
|
||||||
# Broadcast to listening sockets
|
# Broadcast to listening sockets
|
||||||
|
|
Loading…
Reference in New Issue
Block a user