Skip to main content

WebSocket Authentication

All WebSocket connections to the Rhombus platform require API token authentication. This page explains how to obtain a token, construct the connection URL, and handle authentication for both standard and partner API integrations.

Prerequisites

  • A Rhombus organization with API access enabled
  • An API token generated from the Rhombus console
WebSocket connections do not support certificate-based (mTLS) authentication. If your REST API integration uses certificates, you must generate a separate API token for WebSocket.

Generating an API Token

  1. Log in to the Rhombus console
  2. Navigate to Settings > API Access
  3. Click Generate API Token
  4. Copy and securely store the token

Authentication Parameters

WebSocket authentication requires both HTTP headers and query parameters during the handshake:

HTTP Headers

HeaderValueRequired
x-auth-apikeyYour API tokenYes

Query Parameters

ParameterValueRequired
x-auth-schemeapi-token or partner-api-tokenYes
x-auth-orgTarget organization UUIDOnly for partner API

Connection URL Format

Standard API Token

wss://ws.rhombussystems.com:8443/websocket?x-auth-scheme=api-token

Partner API Token

Partner integrations can operate on behalf of client organizations by specifying the target org:
wss://ws.rhombussystems.com:8443/websocket?x-auth-scheme=partner-api-token&x-auth-org={clientOrgUuid}

Authentication Flow

1. Build WebSocket URL with query parameters
         β”‚
         β–Ό
2. Set HTTP headers (x-auth-apikey)
         β”‚
         β–Ό
3. Initiate WebSocket handshake (WSS on port 8443)
         β”‚
         β–Ό
4. Server validates token
         β”‚
    β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
    β–Ό         β–Ό
 Success    Failure
    β”‚      (HTTP 401/403)
    β–Ό
5. Send STOMP CONNECT frame
         β”‚
         β–Ό
6. Receive STOMP CONNECTED frame
         β”‚
         β–Ό
   Connection ready

Retrieving Your Organization UUID

Before subscribing to topics, you need your organization UUID. Retrieve it via the REST API:
curl -X POST https://api2.rhombussystems.com/api/org/getOrgV2 \
  -H "x-auth-apikey: YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
The response includes your orgUuid which you’ll use for topic subscriptions.

Example: Authenticated Connection

import websocket
import json

API_TOKEN = "your-api-token"
ORG_UUID = "your-org-uuid"

url = "wss://ws.rhombussystems.com:8443/websocket?x-auth-scheme=api-token"
headers = {
    "x-auth-apikey": API_TOKEN
}

ws = websocket.create_connection(url, header=headers)
print("WebSocket connected")

Partner API Authentication

If you are a Rhombus partner building integrations on behalf of client organizations:
  1. Use partner-api-token as the x-auth-scheme
  2. Include the client’s orgUuid as the x-auth-org query parameter
  3. Your partner API token must have permissions for the target organization
url = (
    "wss://ws.rhombussystems.com:8443/websocket"
    "?x-auth-scheme=partner-api-token"
    f"&x-auth-org={client_org_uuid}"
)
headers = {"x-auth-apikey": partner_api_token}

ws = websocket.create_connection(url, header=headers)

Security Best Practices

  • Never hardcode API tokens in source code. Use environment variables or a secrets manager.
  • Rotate tokens regularly and revoke unused tokens from the Rhombus console.
  • Use WSS only. The Rhombus endpoint enforces TLS encryption on port 8443.
  • Store WebSocket tokens separately if your application also uses certificate-based REST API authentication.

Troubleshooting

ErrorCauseSolution
HTTP 401Invalid or expired API tokenRegenerate token in the Rhombus console
HTTP 403Token lacks required permissionsCheck token scopes and organization access
Connection timeoutNetwork or firewall issueEnsure outbound access to port 8443 is allowed
STOMP CONNECTED not receivedAuth succeeded but STOMP handshake failedVerify STOMP CONNECT frame format (see Connection Lifecycle)