def __prettyPrintMessage(self, message): if (self.__ignoreJoinsAndLeaves and (message["messageType"] == SSAP_MESSAGE_TYPE.JOIN or message["messageType"] == SSAP_MESSAGE_TYPE.LEAVE)): return print("A(n) " + SSAP_MESSAGE_TYPE.toString(message["messageType"]) + " message was received!") print( json.dumps(message, sort_keys=True, indent=4, separators=(",", ":")))
def __buildMessageStructure(messageType, sessionKey): ''' Includes the data common to all the SSAP message types. Keyword arguments: messageType -- the type of the SSAP message. sessionKey -- the session key to include in the SSAP message. ''' jsonObj = {} jsonObj["body"] = {} jsonObj["direction"] = SSAP_MESSAGE_DIRECTION.toString(SSAP_MESSAGE_DIRECTION.REQUEST) jsonObj["messageType"] = SSAP_MESSAGE_TYPE.toString(messageType) jsonObj["sessionKey"] = sessionKey return jsonObj
def __prettyPrintMessage(self, message): if (self.__ignoreJoinsAndLeaves and (message["messageType"] == SSAP_MESSAGE_TYPE.JOIN or message["messageType"] == SSAP_MESSAGE_TYPE.LEAVE)): return print("A(n) " + SSAP_MESSAGE_TYPE.toString(message["messageType"]) + " message was received!") print(json.dumps(message, sort_keys=True, indent=4, separators=(",", ":")))