Websocket Tools (dccd.tools.websocket)

Connector objects to WebSockets API client to download data.

class dccd.tools.websocket.BasisWebSocket(host, conn={}, subs={})

Basis object to connect at a specified stream to websocket client API.

Parameters:
host : str

Adress of host to connect.

conn : dict

Parameters to connection setting.

subs : dict

Data to subscribe to a stream.

Attributes:
host : str

Adress of host to connect.

conn_para : dict

Parameters of websocket connection.

ws : websockets.client.WebSocketClientProtocol

Connection with the websocket client.

is_connect : bool
  • True if connected.
  • False`otherwise.

Methods

on_open(self, \*\*kwargs) On websocket open.
on_close(self)

On websocket close print and fire event.

on_error(self, error, *args)

On websocket error print and fire event.

on_message(self, message)

On websocket display message.

on_open(self, **kwargs)

On websocket open.

Parameters:
**kwargs

Any relevant keyword arguments to set connection.

wait_that(self, is_true)

Wait before running.