

def open_cont(self, result):
    "Callback to the callback: we've pulled session info from\n        the database.\n        "
    if (self.twsessionstatus != 'auth'):
        self.write_tw_error('You are not authenticated.')
        self.close()
        return
    self.twconnid = self.application.twconntable.generate_connid()
    uid = self.twsession['uid']
    email = self.twsession['email']
    self.application.twlog.info('Player connected to websocket: %s (session %s, connid %d)', self.twsession['email'], self.twsession['sid'], self.twconnid)
    if (not self.application.twservermgr.tworldavailable):
        self.write_tw_error('Tworld service is not available.')
        self.close()
        return
    try:
        self.twconn = self.application.twconntable.add(self, uid, email, self.twsession)
    except Exception as ex:
        self.application.twlog.error('Unable to add connection: %s', ex)
        self.write_tw_error(('Unable to add connection: %s' % (ex,)))
        msg.close()
        return
    try:
        msg = {
            'cmd': 'playeropen',
            'uid': str(uid),
            'email': email,
        }
        self.application.twservermgr.tworld_write(self.twconnid, msg)
    except Exception as ex:
        self.application.twlog.error('Could not write playeropen message to tworld socket: %s', ex)
        self.twconn.close(('Unable to register connection with service: %s' % (ex,)))
        return

dataset/ETHPy150Open erkyrath/tworld/lib/tweblib/handlers.py PlayWebSocketHandler.open_cont/VarMisuse@194/346 `self`->`msg`