class ConnectionHandler(SockJSConnection):

    def __init__(self, *args, **kwargs):
        super(ConnectionHandler, self).__init__(*args, **kwargs)
self.client = brukva.Client()
self.client.connect()
self.client.subscribe('some_channel')

def on_open(self, info):
    self.client.listen(self.on_chan_message)

def on_message(self, msg):
    pass

def on_chan_message(self, msg):
    self.send(msg.body)

def on_close(self):
    self.client.unsubscribe('text_stream')
self.client.disconnect()
клиент python Socket.IO для отправки широковещательных сообщений на сервер TornadIO2