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

# Enable WebSocket service

The Websocket service provides a simple way for a Pulsar client to interact with a Pulsar cluster using languages that do not have an official client library, such as Java, Python, C++, and so on.

This document describes how to enable the WebSocket service on the Pulsar broker, Pulsar proxy, or both of them. Therefore, your client can connect to your Pulsar cluster through the [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API).

<Tabs>
  <Tab title="Enable Websocket on the Pulsar broker only">
    If your Pulsar client directly communicates with your Pulsar cluster through the Pulsar broker, you only need to enable the WebSocket service on the Pulsar broker.

    To enable the WebSocket service, you can set `broker.configData.webSocketServiceEnabled` to `true` in the `values.yaml` YAML file as follows and use the `helm upgrade` command to update the resource.

    1. Enable the WebSocket service.

       This example shows how to enable the WebSocket service on the Pulsar broker without enabling TLS encryption. If you do not enable TLS encryption, your client will connect to a Pulsar cluster through the WebSocket protocol and the port `9090`.

       ```yaml theme={null}
       broker:
         configData:
           webSocketServiceEnabled: true
       ```

       This example shows how to enable the WebSocket service on the Pulsar broker with TLS encryption enabled. If you do enable TLS encryption, your client will connect to a Pulsar cluster through the WebSocket Secure (WSS) protocol and the port `9443`.

       ```yaml theme={null}
       tls:
         enabled: true # --- [1]
         broker:
           enabled: true # --- [2]
       broker:
         configData:
           webSocketServiceEnabled: true # --- [3]
       ```

       * \[1] `tls.enabled`: enable TLS encryption. For details, see [enable TLS encryption on StreamNative Platform components](id:tls-proxy).
       * \[2] `tls.broker.enabled`: enable TLS encryption on the Pulsar broker. For details, see [enable TLS encryption on StreamNative Platform components](id:tls-proxy).
       * \[3] `broker.configData.webSocketServiceEnabled`: enable the WebSocket service on the Pulsar broker.

    2. Apply the new configuration.

       ```
       helm upgrade -f /path/to/your/values.yaml <release_name> streamnative/sn-platform -n <k8s_namespace>
       ```
  </Tab>

  <Tab title="Enable Websocket on the Pulsar proxy only">
    If your Pulsar client directly communicates with your Pulsar cluster through the Pulsar proxy, you only need to enable the WebSocket service on the Pulsar proxy.

    To enable the WebSocket service, you can set `proxy.websocket.enabled` to `true` in the `values.yaml` YAML file as follows and use the `helm upgrade` command to update the resource.

    1. Enable the WebSocket service.

       This example shows how to enable the WebSocket service on the Pulsar proxy without enabling TLS encryption. If you do not enable TLS encryption, your client will connect to a Pulsar cluster through the WebSocket protocol and the port `9090`.

       ```yaml theme={null}
       proxy:
         websocket:
           component: websocket
           enabled: true
       ```

       This example shows how to enable the WebSocket service on the Pulsar proxy with TLS encryption enabled. If you do enable TLS encryption, your client will connect to a Pulsar cluster through the WebSocket Secure (WSS) protocol and the port `9443`.

       ```yaml theme={null}
       tls:
         enabled: true # --- [1]
         proxy:
           enabled: true # --- [2]
       proxy:
         websocket:
           component: websocket
           enabled: true # --- [3]
       ```

       * \[1] `tls.enabled`: enable TLS encryption. For details, see [enable TLS encryption on StreamNative Platform components](id:tls-proxy).
       * \[2] `tls.proxy.enabled`: enable TLS encryption on the Pulsar proxy. For details, see [enable TLS encryption on StreamNative Platform components](id:tls-proxy).
       * \[3] `proxy.websocket.enabled`: enable the WebSocket service on the Pulsar proxy.

    2. Apply the new configuration.

       ```bash theme={null}
       helm upgrade -f /path/to/your/values.yaml <release_name> streamnative/sn-platform -n <k8s_namespace>
       ```
  </Tab>

  <Tab title="Enable Websocket on both the Pulsar broker and Pulsar proxy">
    If your Pulsar clients communicate with your Pulsar cluster through both the Pulsar broker and Pulsar proxy, you need to enable the WebSocket service on both the Pulsar broker and Pulsar proxy.

    To enable the WebSocket service, you can set `broker.configData.webSocketServiceEnabled` and `proxy.websocket.enabled` to `true` in the `values.yaml` YAML file as follows and use the `helm upgrade` command to update the resource.

    1. Enable the WebSocket service.

       This example shows how to enable the WebSocket service on the Pulsar broker and Pulsar proxy without enabling TLS encryption. If you do not enable TLS encryption, your client will connect to a Pulsar cluster through the WebSocket protocol and the port `9090`.

       ```yaml theme={null}
       broker:
         configData:
           webSocketServiceEnabled: true

       proxy:
         websocket:
           component: websocket
           enabled: true
       ```

       This example shows how to enable the WebSocket service on the Pulsar broker and Pulsar proxy with TLS encryption enabled. If you do enable TLS encryption, your client will connect to a Pulsar cluster through the WebSocket Secure (WSS) protocol and the port `9443`.

       ```yaml theme={null}
       tls:
         enabled: true # --- [1]
         proxy:
           enabled: true # --- [2]

         broker:
           enabled: true # --- [3]

       proxy:
         websocket:
           component: websocket
           enabled: true # --- [4]

       broker:
         configData:
           webSocketServiceEnabled: true # --- [5]
       ```

       * \[1] `tls.enabled`: enable TLS encryption. For details, see [enable TLS encryption on StreamNative Platform components](id:tls-proxy).
       * \[2] `tls.proxy.enabled`: enable TLS encryption on the Pulsar proxy. For details, see [enable TLS encryption on StreamNative Platform components](id:tls-proxy).
       * \[3] `tls.broker.enabled`: enable TLS encryption on the Pulsar broker. For details, see [enable TLS encryption on StreamNative Platform components](id:tls-proxy).
       * \[4] `proxy.websocket.enabled`: enable the WebSocket service on the Pulsar proxy.
       * \[5] `broker.configData.webSocketServiceEnabled`: enable the WebSocket service on the Pulsar broker.

    2. Apply the new configuration.

       ```
       helm upgrade -f /path/to/your/values.yaml <release_name> streamnative/sn-platform -n <k8s_namespace>
       ```
  </Tab>
</Tabs>

## Related topics

* [Connect to Pulsar cluster using WebSocket API](/private-cloud/v1/build/platform-connect-websocket)
