def __init__(self, serverUrl, protocols, connectionEstablishedHandler, dataReceivedEventHandler): ''' Initializes the state of the client. Keyword arguments: serverURL -- the URL of the websocket server. protocols -- a list containing the websocket protocols supported by the websockets client. connectionEstablishedHandler -- a function that will be invoked after establishing the websocket connection. dataReceivedHandler -- a function that will be invoked after receiving data from the websocket. ''' WebSocketClient.__init__(self, serverUrl, protocols) self.__logger = LogFactory.configureLogger(self, logging.INFO, LogFactory.DEFAULT_LOG_FILE) self.__connectionEstablishedHandler = connectionEstablishedHandler self.__dataReceivedEventHandler = dataReceivedEventHandler
def __init__(self, callback, connectionData, debugMode=False): ''' Initializes the state of the endpoint. Keyword arguments: callback -- the object that will process the incoming SSAP messages. connectionData -- the object that stores the configuration of the websocket connection. debugMode -- a flag that enables additional debug messages. ''' SSAPEndpoint.__init__(self, callback) if (debugMode) : logLevel = logging.DEBUG else: logLevel = logging.INFO self.__logger = LogFactory.configureLogger(self, logLevel, LogFactory.DEFAULT_LOG_FILE) self.__queue = GenericThreadSafeList() self.__websocket = None self.__connectionData = connectionData self.__activeSubscriptions = 0