コード例 #1
0
ファイル: __init__.py プロジェクト: hekevintran/wdb
    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)
コード例 #2
0
ファイル: __init__.py プロジェクト: Kozea/wdb
    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)
コード例 #3
0
    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)
コード例 #4
0
ファイル: __init__.py プロジェクト: xx182/wdb
    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)