def open(self, uuid): if self.request.headers['Origin'] != 'http://%s' % ( self.request.headers['Host']): self.close() return self.uuid = uuid if isinstance(self.uuid, bytes): self.uuid = self.uuid.decode('utf-8') if self.uuid in websockets.uuids: log.warn( 'Websocket already opened for %s. Closing previous one' % self.uuid) websockets.send(self.uuid, 'Die') websockets.close(uuid) if self.uuid not in sockets.uuids: log.warn( 'Websocket opened for %s with no correponding socket' % self.uuid) sockets.send(self.uuid, 'Die') self.close() return log.info('Websocket opened for %s' % self.uuid) websockets.add(self.uuid, self)
def on_open(self, uuid): self.uuid = uuid if isinstance(self.uuid, bytes): self.uuid = self.uuid.decode('utf-8') if self.uuid in websockets.uuids: log.warn( 'Websocket already opened for %s. Closing previous one' % self.uuid ) websockets.send(self.uuid, 'Die') websockets.close(uuid) if self.uuid not in sockets.uuids: log.warn( 'Websocket opened for %s with no correponding socket' % self.uuid ) sockets.send(self.uuid, 'Die') self.close() return log.info('Websocket opened for %s' % self.uuid) websockets.add(self.uuid, self)
def open(self, uuid): if self.request.headers['Origin'] != 'http://%s' % ( self.request.headers['Host']): self.close() return self.uuid = uuid if isinstance(self.uuid, bytes): self.uuid = self.uuid.decode('utf-8') if self.uuid in websockets.uuids: log.warn('Websocket already opened for %s. Closing previous one' % self.uuid) websockets.send(self.uuid, 'Die') websockets.close(uuid) if self.uuid not in sockets.uuids: log.warn('Websocket opened for %s with no correponding socket' % self.uuid) sockets.send(self.uuid, 'Die') self.close() return log.info('Websocket opened for %s' % self.uuid) websockets.add(self.uuid, self)
def on_open(self, uuid): self.uuid = uuid if isinstance(self.uuid, bytes): self.uuid = self.uuid.decode('utf-8') if self.uuid in websockets.uuids: log.warn( 'Websocket already opened for %s. Closing previous one' % self.uuid ) websockets.send(self.uuid, 'Die') websockets.close(uuid) if self.uuid not in sockets.uuids: log.warn( 'Websocket opened for %s with no correponding socket' % self.uuid ) sockets.send(self.uuid, 'Die') self.close() return log.info('Websocket opened for %s' % self.uuid) websockets.add(self.uuid, self)