Wednesday, April 29, 2020

Django channel async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'}) error

In Python shell  as per directed on django channel site https://channels.readthedocs.io/en/latest/tutorial/part_2.html#enable-a-channel-layer
$ python3 manage.py shell  >>> import channels.layers  >>> channel_layer = channels.layers.get_channel_layer()  >>> from asgiref.sync import async_to_sync  >>> async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})  >>> async_to_sync(channel_layer.receive)('test_channel')  {'type': 'hello'}


please help

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/78706ec6-cd0f-4b5c-a3a5-422e7185a70e%40googlegroups.com.

No comments:

Post a Comment