Websocket
PSLX implements a basic Websocket client in websocket_base.py, where the following methods are supported:
__init__(ws_url, params, logger)
- Description: Initialize a websocket client.
- Arguments:
- ws_url: the websocket URL.
- params: other parameters if necessary. It should be a dict.
- logger: the logger to record events.
bind_to_op(op)
- Description: bind the websocket client to an operator.
- Arguments:
- op: the operator to be binded. In order to bind correctly, the operator needs to have a
ws_msg_parser(message)
function defined as one of the methods.
- op: the operator to be binded. In order to bind correctly, the operator needs to have a
start()
- Description: start to consume the websocket.