Python tornado.websocket 模块,html() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用tornado.websocket.html()

项目:django-tornado-websockets    作者:Kocal    | 项目源码 | 文件源码
def emit(self, event, data):
        """
            Sends a given event/data combinaison to the client of this WebSocket.

            Wrapper for `tornado.websocket.WebSocketHandler.write_message <http://www.tornadoweb.org/en/stable/
            websocket.html#tornado.websocket.WebSocketHandler.write_message>`_ method.

            :param event: event name to emit
            :param data: associated data
            :type event: str
            :type data: dict
        """

        self.write_message({
            'event': event,
            'data': data
        })
项目:touch-pay-client    作者:HackPucBemobi    | 项目源码 | 文件源码
def on_close(self):
        if self.group in listeners:
            listeners[self.group].remove(self)
        del names[self]
        # notify clients that a member has left the groups
        for client in listeners.get(self.group, []):
            client.write_message('-' + self.name)
        print('%s:DISCONNECT from %s' % (time.time(), self.group))

# if your webserver is different from tornado server uncomment this
# or override using something more restrictive:
# http://tornado.readthedocs.org/en/latest/websocket.html#tornado.websocket.WebSocketHandler.check_origin
# def check_origin(self, origin):
#    return True
项目:emte-trading    作者:mdipierro    | 项目源码 | 文件源码
def check_origin(self, origin):
        """
        Accepts all cross-origin traffic
        :param origin: is the value of the ``Origin`` HTTP header, the url responsible for initiating this request.
        .. seealso:: `~WebSocketHandler.check_origin <http://www.tornadoweb.org/en/stable/_modules/tornado/websocket.html#WebSocketHandler.check_origin>`
        """
        return True
项目:true_review_web2py    作者:lucadealfaro    | 项目源码 | 文件源码
def on_close(self):
        if self.group in listeners:
            listeners[self.group].remove(self)
        del names[self]
        # notify clients that a member has left the groups
        for client in listeners.get(self.group, []):
            client.write_message('-' + self.name)
        print '%s:DISCONNECT from %s' % (time.time(), self.group)

# if your webserver is different from tornado server uncomment this
# or override using something more restrictive:
# http://tornado.readthedocs.org/en/latest/websocket.html#tornado.websocket.WebSocketHandler.check_origin
# def check_origin(self, origin):
#    return True
项目:Problematica-public    作者:TechMaz    | 项目源码 | 文件源码
def on_close(self):
        if self.group in listeners:
            listeners[self.group].remove(self)
        del names[self]
        # notify clients that a member has left the groups
        for client in listeners.get(self.group, []):
            client.write_message('-' + self.name)
        print '%s:DISCONNECT from %s' % (time.time(), self.group)

# if your webserver is different from tornado server uncomment this
# or override using something more restrictive:
# http://tornado.readthedocs.org/en/latest/websocket.html#tornado.websocket.WebSocketHandler.check_origin
# def check_origin(self, origin):
#    return True
项目:rekall-agent-server    作者:rekall-innovations    | 项目源码 | 文件源码
def on_close(self):
        if self.group in listeners:
            listeners[self.group].remove(self)
        del names[self]
        # notify clients that a member has left the groups
        for client in listeners.get(self.group, []):
            client.write_message('-' + self.name)
        print('%s:DISCONNECT from %s' % (time.time(), self.group))

# if your webserver is different from tornado server uncomment this
# or override using something more restrictive:
# http://tornado.readthedocs.org/en/latest/websocket.html#tornado.websocket.WebSocketHandler.check_origin
# def check_origin(self, origin):
#    return True
项目:slugiot-client    作者:slugiot    | 项目源码 | 文件源码
def on_close(self):
        if self.group in listeners:
            listeners[self.group].remove(self)
        del names[self]
        # notify clients that a member has left the groups
        for client in listeners.get(self.group, []):
            client.write_message('-' + self.name)
        print '%s:DISCONNECT from %s' % (time.time(), self.group)

# if your webserver is different from tornado server uncomment this
# or override using something more restrictive:
# http://tornado.readthedocs.org/en/latest/websocket.html#tornado.websocket.WebSocketHandler.check_origin
# def check_origin(self, origin):
#    return True