📜  使用 redis 设置检查 django 频道 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:32.831000             🧑  作者: Mango

代码示例1
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')