ws_handler.py 文件源码

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

项目:coretools 作者: iotile 项目源码 文件源码
def send_notification(self, name, change_type, change_info, directed_client=None):
        """Send an unsolicited notification to someone."""

        # If the notification is directed, make sure it is directed at us
        if directed_client is not None and self.client_id != directed_client:
            return

        notif_object = {'type': 'notification', 'operation': change_type, 'name': name}
        if change_info is not None:
            notif_object['payload'] = change_info

        msg = msgpack.packb(notif_object)

        try:
            self.write_message(msg, binary=True)
        except tornado.websocket.WebSocketClosedError:
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号