def on_close(self): Logging.instance().log("SERVER: Websocket connection closed.") UserComponent.instance().del_user(self)
def on_message(self, message): user = UserComponent.instance().find(self) if(user): MessageParser.instance().parse(message,user) else: Logging.instance().log("SERVER: rx'd message from unknown client location!!") # this is bad.
def parse(self,raw_message,user_obj): jObj = None try: jObj = json.loads(raw_message) except Exception, err: Logging.instance().log("PARSER: Invalid json object with message (%s)" % (raw_message))
def open(self): Logging.instance().log("SERVER: Websocket connection opened.") user = User(self) UserComponent.instance().add_user(self,user)
def __init__(self): MessageParser.__INST__ = self Logging.instance().log("PARSER: messageparser initialized.")