ws.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:web_ctp 作者: molebot 项目源码 文件源码
def echo(ws):
    cs.add(ws)
    print(u'???'+str(ws)+u'???websocket')
    for _msg in cache['msg']:
        ws.send(_msg)
    while True:
        msg = ws.receive()
        if msg is not None:
            _dict = json.loads(msg)
            _type = _dict.get("action",EVENT_EMPTY)
            if _type in funcs:
                funcs[_type]((msg,_dict))
            else:
                empty_func(msg)
        else: break
    cs.remove(ws)
    print(u'???'+str(ws)+u'????')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号