From 60700da0dff0df9b361b975c223e8054b7ceb54c Mon Sep 17 00:00:00 2001 From: Cropse Date: Mon, 17 Jul 2017 11:25:01 +0800 Subject: [PATCH 1/2] Update faqs.rst Add the example of non-Django application. --- docs/faqs.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/faqs.rst b/docs/faqs.rst index e2bd585..17a0340 100755 --- a/docs/faqs.rst +++ b/docs/faqs.rst @@ -136,7 +136,12 @@ a few choices: (see :doc:`deploying`), you can import the channel layer directly as ``yourproject.asgi.channel_layer`` and call ``send()`` and ``receive_many()`` on it directly. See the :doc:`ASGI spec ` for the API the channel layer - presents. + presents. Here's what that looks like: + + >>> from mysite.asgi import channel_layer + >>> from channels import Channel, Group + >>> Channel("channel_name").send({"text":"channel_text"}) + >>> Group("group_name").send({"text":"group_text"}) * If you just need to send messages in when events happen, you can make a management command that calls ``Channel("namehere").send({...})`` From ff2f09c3a1f8014a5938ceff512593d55cd0eb29 Mon Sep 17 00:00:00 2001 From: Cropse Date: Mon, 17 Jul 2017 11:27:45 +0800 Subject: [PATCH 2/2] Update faqs.rst --- docs/faqs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faqs.rst b/docs/faqs.rst index 17a0340..701f9b9 100755 --- a/docs/faqs.rst +++ b/docs/faqs.rst @@ -138,7 +138,7 @@ a few choices: on it directly. See the :doc:`ASGI spec ` for the API the channel layer presents. Here's what that looks like: - >>> from mysite.asgi import channel_layer + >>> from yourproject.asgi import channel_layer >>> from channels import Channel, Group >>> Channel("channel_name").send({"text":"channel_text"}) >>> Group("group_name").send({"text":"group_text"})