mirror of
https://github.com/django/daphne.git
synced 2025-07-28 07:59:45 +03:00
Fix doc imports and a function signature
This commit is contained in:
parent
dfc11d4a67
commit
7cfb3139dd
|
@ -95,7 +95,7 @@ Now, that's taken care of adding and removing WebSocket send channels for the
|
||||||
we're not going to store a history of messages or anything and just replay
|
we're not going to store a history of messages or anything and just replay
|
||||||
any message sent in to all connected clients. Here's all the code::
|
any message sent in to all connected clients. Here's all the code::
|
||||||
|
|
||||||
from channels import Channel
|
from channels import Channel, Group
|
||||||
from channels.decorators import consumer
|
from channels.decorators import consumer
|
||||||
|
|
||||||
@consumer("django.websocket.connect", "django.websocket.keepalive")
|
@consumer("django.websocket.connect", "django.websocket.keepalive")
|
||||||
|
@ -344,7 +344,7 @@ have a ChatMessage model with ``message`` and ``room`` fields::
|
||||||
from .models import ChatMessage
|
from .models import ChatMessage
|
||||||
|
|
||||||
@consumer("chat-messages")
|
@consumer("chat-messages")
|
||||||
def msg_consumer(room, message):
|
def msg_consumer(channel, room, message):
|
||||||
# Save to model
|
# Save to model
|
||||||
ChatMessage.objects.create(room=room, message=message)
|
ChatMessage.objects.create(room=room, message=message)
|
||||||
# Broadcast to listening sockets
|
# Broadcast to listening sockets
|
||||||
|
|
Loading…
Reference in New Issue
Block a user