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

111 views
Skip to first unread message

Aditya Bohra

unread,
Apr 29, 2020, 10:09:11 AM4/29/20
to Django users
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
Reply all
Reply to author
Forward
0 new messages