BlockchainWebsocket

# Import statement

from bcx.websocket import BlockchainWebsocket
class BlockchainWebsocket[source]

Low level API to interact with Blockchain Exchange

Attributes

ws

Connection to blockchain exchange websocket

ws_connect_headers

List of additional headers sent to blockchain exchange

ws_connect_timeout_seconds

Wait for socket to connect before dropping connection

ws_origin

Blockchain exchange websocket origin

ws_uri

URI of blockchain exchange websocket

Methods

connect(self)

Connect to blockchain exchange websocket

reconnect(self)

Reconnect to blockchain exchange websocket

send(self, message)

Send raw string message to blockchain exchange

send_json(self, message)

Send message represented as python dictionary to blockchain exchange

set_ws_message_handler(self, handler)

Set method responsible for handling messages received from blockchain exchange

connect(self) → None[source]

Connect to blockchain exchange websocket

reconnect(self) → None[source]

Reconnect to blockchain exchange websocket

send(self, message: str) → None[source]

Send raw string message to blockchain exchange

Parameters
messagestr
send_json(self, message: dict) → None[source]

Send message represented as python dictionary to blockchain exchange

Parameters
messageDict
set_ws_message_handler(self, handler: <built-in function callable>)[source]

Set method responsible for handling messages received from blockchain exchange

property ws

Connection to blockchain exchange websocket

property ws_connect_headers

List of additional headers sent to blockchain exchange

property ws_connect_timeout_seconds

Wait for socket to connect before dropping connection

property ws_origin

Blockchain exchange websocket origin

property ws_uri

URI of blockchain exchange websocket