> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keephq.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Websocket

## In workflows

This provider can be used in workflows.

As "step" to query data, example:

```yaml theme={null}
steps:
    - name: Query websocket
      provider: websocket
      config: "{{ provider.my_provider_name }}"
      with:
        socket_url: {value}  # The websocket URL to query.
        timeout: {value}  # Connection Timeout. Defaults to None.
        data: {value}  # Data to send through the websocket. Defaults to None.
```

If you need workflow examples with this provider, please raise a [GitHub issue](https://github.com/keephq/keep/issues).

## Outputs

The `query` function of `WebsocketProvider` outputs the following format:

```json theme={null}
{
  "connection": true,
  "data": "Received data from the websocket"
}
```

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.

See [documentation](https://websocket-client.readthedocs.io/en/latest/api.html#websocket.WebSocket.send) for more information.
