'Called when a websocket has been created successfully.'

def run_websocket(self):

    if getattr(self, 'prevent_wsgi_call', False):
        return
    if (not hasattr(self.server, 'clients')):
        self.server.clients = {}
    try:
        self.server.clients[self.client_address] = Client(self.client_address, self.websocket)
        list(self.application(self.environ, (lambda s, h, e=None: [])))
    finally:
        del self.server.clients[self.client_address]
        if (not self.websocket.closed):
            self.websocket.close()
        self.environ.update({'wsgi.websocket': None})
        self.websocket = None
