Skip to main content
The streaming client authenticates with the same signing key as the REST client. There is no separate stream credential: give it the key id and private key seed you use for REST calls, and it signs the WebSocket handshake for you.
As with the REST client, StreamClient() reads PARLAYX_KEY_ID and PARLAYX_PRIVATE_KEY_HEX from the environment when you do not pass them. See Authentication for how each credential resolves. The signature is carried in the upgrade URL’s query string, because a WebSocket upgrade has no header slot to put it in. Your private key never leaves the process: only the key id, a timestamp, and the signature go on the wire.
Run the streaming client on a server you control, never in a browser or other untrusted client. Signing needs your private key in the running process, so shipping it to end users would hand them your signing key. The TypeScript client signs with node:crypto and requires Node.js 20 or newer; the Python client requires Python 3.11 or newer.
Because the signature covers the timestamp, it expires. Both clients sign a fresh handshake on every connect attempt, including reconnects, so a long-lived stream keeps working without you refreshing anything. For the wire-level handshake, see the WebSocket API’s Authentication.