From 60700da0dff0df9b361b975c223e8054b7ceb54c Mon Sep 17 00:00:00 2001 From: Cropse Date: Mon, 17 Jul 2017 11:25:01 +0800 Subject: [PATCH] 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({...})``