Websocket
Websocket Provider
WebsocketProvider is a class that implements a simple websocket provider.
Inputs
The query
function of WebsocketProvider
takes the following arguments:
socket_url
(str): The websocket URL to query.timeout
(int | None, optional): Connection Timeout. Defaults to None.data
(str | None, optional): Data to send through the websocket. Defaults to None.**kwargs
(optional): Additional optional parameters can be provided as key-value pairs.
See documentation for more information.
Outputs
The query
function of WebsocketProvider
outputs the following format:
The connection
field indicates whether the websocket connection was successful (true
) or not (false
). The data
field contains the received data from the websocket.
If the connection
field indicates unsuccessful connection (false
) then the object will also include an error
field with details about the failed connection.
Authentication Parameters
The Websocket provider does not require any specific authentication parameters.
Connecting with the Provider
To connect with the Websocket provider and perform queries, follow these steps:
Initialize the provider and provider configuration in your system. Use the query function of the WebsocketProvider to interact with the websocket.
Example usage: