1. Operating StreamNative Platform
  2. Protocols

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.

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.

    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.

    tls:
      enabled: true # --- [1]
      broker:
        enabled: true # --- [2]
    broker:
      configData:
        webSocketServiceEnabled: true # --- [3]
    
  2. Apply the new configuration.

    helm upgrade -f /path/to/your/values.yaml <release_name> streamnative/sn-platform -n <k8s_namespace>
    
Previous
Configure MQTT on Pulsar