mirror of
https://github.com/django/daphne.git
synced 2025-07-14 18:02:17 +03:00
Typo in Example using class-based consumer (#526)
Typo in Example using class-based consumer from section "2.6.3 WebSocket Multiplexing"
This commit is contained in:
parent
b14bbeebe4
commit
4185798731
|
@ -194,7 +194,7 @@ Example using class-based consumer::
|
||||||
|
|
||||||
from channels.generic.websockets import WebsocketDemultiplexer, JsonWebsocketConsumer
|
from channels.generic.websockets import WebsocketDemultiplexer, JsonWebsocketConsumer
|
||||||
|
|
||||||
class EchoConsumer(websockets.JsonWebsocketConsumer):
|
class EchoConsumer(JsonWebsocketConsumer):
|
||||||
def connect(self, message, multiplexer, **kwargs):
|
def connect(self, message, multiplexer, **kwargs):
|
||||||
# Send data with the multiplexer
|
# Send data with the multiplexer
|
||||||
multiplexer.send({"status": "I just connected!"})
|
multiplexer.send({"status": "I just connected!"})
|
||||||
|
@ -207,7 +207,7 @@ Example using class-based consumer::
|
||||||
multiplexer.send({"original_message": content})
|
multiplexer.send({"original_message": content})
|
||||||
|
|
||||||
|
|
||||||
class AnotherConsumer(websockets.JsonWebsocketConsumer):
|
class AnotherConsumer(JsonWebsocketConsumer):
|
||||||
def receive(self, content, multiplexer=None, **kwargs):
|
def receive(self, content, multiplexer=None, **kwargs):
|
||||||
# Some other actions here
|
# Some other actions here
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user