WebsocketRPC¶
Note
This is a low level class that can be used in combination with GrapheneClient
This class allows to call API methods exposed by the witness node via websockets. It does not support notifications and is not run asynchronously.
-
class
beemgrapheneapi.graphenewsrpc.
GrapheneWebsocketRPC
(urls, user='', password='', **kwargs)¶ This class allows to call API methods synchronously, without callbacks. It logs in and registers to the APIs:
- database
- history
Parameters: - urls (str) – Either a single Websocket URL, or a list of URLs
- user (str) – Username for Authentication
- password (str) – Password for Authentication
- apis (Array) – List of APIs to register to (default: [“database”, “network_broadcast”])
- num_retries (int) – Try x times to num_retries to a node on disconnect, -1 for indefinitely
Available APIs
- database
- network_node
- network_broadcast
- history
Usage:
ws = GrapheneWebsocketRPC("ws://10.0.0.16:8090","","") print(ws.get_account_count())
Note
This class allows to call methods available via websocket. If you want to use the notification subsystem, please use
GrapheneWebsocket
instead.-
rpcexec
(payload)¶ Execute a call by sending the payload
Parameters: payload (json) – Payload data
Raises: - ValueError – if the server does not respond in proper JSON format
- RPCError – if the server returns an error