Skip to content

Establish Connection

Use a wsTicket to establish an authenticated WebSocket connection. This page describes the connection URL, session lifetime, and security requirements.

Connection URL

WebSocket uses the wss protocol.

text
wss://api.example.com/wlte/v1/ws?ticket={ticket}

The environment domain is provided when the API environment is enabled. The path is fixed as:

text
/wlte/v1/ws

Establishment Flow

  1. Call Create WebSocket Ticket to obtain a one-time wsTicket.
  2. Establish the WebSocket connection using the ticket query parameter.
  3. After the connection succeeds, the connection becomes an authenticated session.
  4. The client may send Session Ping to confirm that the session is available.

Examples

Browser example:

js
const socket = new WebSocket(
  'wss://api.example.com/wlte/v1/ws?ticket=wst_01HX...'
);

Node.js example using the ws library:

js
import WebSocket from 'ws';

const socket = new WebSocket(
  'wss://api.example.com/wlte/v1/ws?ticket=wst_01HX...'
);

Session Lifetime

The WebSocket session lifetime is constrained by the access token.

  • A WebSocket session cannot outlive the access token used to create the ticket
  • When the access token expires, the corresponding WebSocket session is closed
  • Existing connections may be closed when the access token is revoked, the API client is disabled, or permissions are changed
  • After a connection closes, obtain a new access token or a new wsTicket and establish a new connection if WebSocket access is still needed

Security Requirements

  • Use wss only
  • Do not log the full ticket or accessToken in pages, logs, error reports, or monitoring systems
  • Do not expose clientSecret to browsers, mobile apps, or public code repositories
  • Server-side access logs should avoid recording the full ticket in URL query parameters

Reconnection

After the connection closes, the client should follow Heartbeat and Reconnection.

Docs buildVersion v1.2.19-20260602-174859-60
Copyright © 2026 WLTE