mirror of
https://github.com/django/daphne.git
synced 2025-04-21 01:02:06 +03:00
Merge pull request #71 from georgebrock/patch-1
Docs: reply_channel is a property of message
This commit is contained in:
commit
e575693093
|
@ -109,11 +109,11 @@ message. Suddenly, a view is merely another example of a consumer::
|
|||
# Listens on http.request
|
||||
def my_consumer(message):
|
||||
# Decode the request from JSON-compat to a full object
|
||||
django_request = Request.decode(message.content)
|
||||
django_request = Request.channel_decode(message.content)
|
||||
# Run view
|
||||
django_response = view(django_request)
|
||||
# Encode the response into JSON-compat format
|
||||
Channel(reply_channel).send(django_response.encode())
|
||||
message.reply_channel.send(django_response.channel_encode())
|
||||
|
||||
In fact, this is how Channels works. The interface servers transform connections
|
||||
from the outside world (HTTP, WebSockets, etc.) into messages on channels,
|
||||
|
|
Loading…
Reference in New Issue
Block a user