From 88d3379e3189d04065a3030375976d0d42111a0d Mon Sep 17 00:00:00 2001 From: George Brocklehurst Date: Sat, 6 Feb 2016 18:26:41 -0500 Subject: [PATCH 1/2] Docs: reply_channel is a property of message Update an example where `reply_channel` was a global, and contained the channel name rather than a channel objects. --- docs/concepts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/concepts.rst b/docs/concepts.rst index b523d49..5066cb5 100644 --- a/docs/concepts.rst +++ b/docs/concepts.rst @@ -113,7 +113,7 @@ message. Suddenly, a view is merely another example of a consumer:: # 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.encode()) In fact, this is how Channels works. The interface servers transform connections from the outside world (HTTP, WebSockets, etc.) into messages on channels, From 85bb8c98d2143b28f7556a90bf7a825373125d9b Mon Sep 17 00:00:00 2001 From: George Brocklehurst Date: Sun, 7 Feb 2016 10:19:21 -0500 Subject: [PATCH 2/2] Docs: Update encode/decode methods in example. `encode` is now `channel_encode`, and `decode` is now `channel_decode`. --- docs/concepts.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/concepts.rst b/docs/concepts.rst index 5066cb5..5b470fc 100644 --- a/docs/concepts.rst +++ b/docs/concepts.rst @@ -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 - message.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,