Sub3

This is the main module of this package. It is provided as a simple “no-post processing, only print” package and as such it’s highly recommended to expend it through sub-classing to add your own data processing to it.

class sub3.Sub3(server_url: str, rpc: Union[str, dict], logger: Optional[Logger] = None)[source]

Base connection client for asyncio JSON-RPC calls.

Parameters
  • server_url (str) – URL of the node to connect to

  • rpc (Union[str, dict]) – Standard RPC PubSub

  • logger (Optional[logging.Logger], optional) – Custom logger, will create one if this is not provided.

async on_closed()[source]

This is called when the WebSocket has been closed

async on_confirmation(confirmation: str)[source]

This is called when a confirmation is received from a successful RPC subscription

async on_connect(connection_mess)[source]

This is called after a successful connection

async on_connection_error(error: str)[source]

This is called after a connection error from the WebSocket

async on_data(raw_data: str)[source]

This is called to process the incoming data from the stream

async on_disconnect()[source]

This is called when the WebSocket has disconnected

async on_exception(exception: Exception)[source]

This is called on an unknown exception

async on_request_error(error: str)[source]

This is called when the RPC request returned an error