It will only work with a Redis channel layer - in memory does not transport
things across processes. As long as everything being used has the same
channel layer settings and talks to the same Redis, I don't see why it
wouldn't work.

Andrew

On Wed, Jan 11, 2017 at 3:07 PM, Gene <evgeni.maka...@gmail.com> wrote:

> I tried first with inmemory, then with asgi_redis.RedisChannelLayer
> same result
> working in runserver mode
>
> четверг, 12 января 2017 г., 2:06:15 UTC+3 пользователь Andrew Godwin
> написал:
>>
>> That code looks correct. What channel layer are you using?
>>
>> On Wed, Jan 11, 2017 at 2:55 PM, Gene <evgeni....@gmail.com> wrote:
>>
>>> I'm trying to send messages to channels outside of consumers, as said in
>>> documentation but can't get a result.
>>>
>>> For example,
>>> in consumers.py I have:
>>>
>>> def channel_send(channel, data):
>>>     channel.send({
>>>         'text': json.dumps(data)
>>>     })
>>>
>>> def group_send(kind, data):
>>>     data = {
>>>         'kind': kind,
>>>         'data': data
>>>     }
>>>     channel_send(Group(kind), data)
>>>
>>> def ws_connect(message):
>>>     Group("location_update").add(message.reply_channel)
>>>     channel_send(message.reply_channel, {'accept': True})
>>>     group_send('location_update', {'msg': 'connected'})
>>>
>>> def ws_disconnect(message):
>>>     # Remove from reader group on clean disconnect
>>>     Group("location_update").discard(message.reply_channel)
>>>
>>> def ws_message(message):
>>>     group_send('location_update', {'msg': 'connected'})
>>>
>>>
>>> When I send message from browser over websocket, I got a response in
>>> console:
>>> {"kind": "location_update", "data": {"msg": "connected"}}
>>>
>>> but, for example, when I try to use group_send function inside
>>> management command, or if I try to use group_send in* python manage.py
>>> shell* regime from shell - I don't get anything in the browser
>>>
>>> channels==1.0.1
>>>
>>> What may be the issue?
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/d1d54866-c155-40d7-abef-e5157f51d337%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/d1d54866-c155-40d7-abef-e5157f51d337%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/1e890c7d-bc39-4fd9-815c-7a83d332b169%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1e890c7d-bc39-4fd9-815c-7a83d332b169%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1upvvoz6MGpS2JdJC%3DBkq2dchc4iLv%2BhDb5wE0KGAj0_pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to