All configuration options are passed as the second argument toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/foxytp/stelar-time-real/llms.txt
Use this file to discover all available pages before exploring further.
new StelarClient(url, {...}). The first argument is the server URL or port. Every option is optional.
Reconnection
Whether to automatically reconnect after a disconnection. When
true, the client uses exponential backoff with jitter between attempts. Defaults to true.Maximum number of reconnection attempts before giving up and emitting
'reconnect_failed'. Defaults to 10. Set to Infinity to retry forever.Base delay in milliseconds for the first reconnection attempt. Each subsequent attempt uses exponential backoff:
base × 1.5^(attempt - 1), capped at maxReconnectionDelay. Defaults to 1000 (1 s).Maximum delay in milliseconds between reconnection attempts. The exponential backoff will not exceed this value. A random jitter of ±20% is applied to avoid thundering herd on server restart. Defaults to
30000 (30 s).Protocol
Protocol mode. In TCP mode, the client automatically connects to
'ws' uses the WebSocket protocol (RFC 6455) and works in both browsers and Node.js. 'tcp' uses the custom binary protocol and is Node.js only — lower overhead, lower latency, ideal for server-to-server communication. Defaults to 'ws'.port + 1 relative to the WebSocket URL unless a full TCP address is provided.Maximum outgoing message payload size in bytes. Messages exceeding this are silently dropped. Defaults to
10485760 (10 MB).Maximum incoming WebSocket frame size in bytes that the client will accept. Frames larger than this trigger a parse error. Defaults to
10485760 (10 MB).Heartbeat
How often (in milliseconds) the client sends a heartbeat to keep the connection alive. Defaults to
30000 (30 s). Should generally match the server’s heartbeatInterval or be lower.ACK (Request-Response)
Timeout in milliseconds for ACK promises created by
client.request(...). If the server does not respond within this window, the promise is rejected with a timeout error. Defaults to 5000 (5 s).Message Queue
Number of messages to buffer when the client is disconnected. When the client reconnects, buffered messages are flushed automatically in order. If the queue is full, the oldest message is discarded to make room. Defaults to
100.Messages are only queued when reconnection is true. The onMessageQueued hook fires for each queued message; onQueueDrained fires when all queued messages have been sent after reconnection.Security
Enable TLS for the connection. When
true, WebSocket connections use wss:// and TCP connections use TLS. Has no effect in browsers (use a wss:// URL directly). Defaults to false.Whether to reject TLS connections with an invalid or self-signed certificate. Set to
false in development environments with self-signed certs. Defaults to true. Only applies in Node.js; browsers always validate certificates.Custom HTTP headers to include in the WebSocket upgrade handshake request. Useful for passing authentication tokens or custom metadata. Only works in Node.js; browsers do not support custom WebSocket headers.
Compression
Enable
permessage-deflate WebSocket compression on the client. The client will advertise compression support in the upgrade handshake; frames are compressed only when the server also supports and negotiates it. Defaults to false. No effect in TCP mode.Logging
Controls client-side logging. Pass a log level string, a
Logger instance, or false to disable. Defaults to 'warn'.Hooks
Lifecycle callbacks for client events. Returning
false from onBeforeEmit cancels the send. See the Hooks reference for the full list of client hooks and their signatures.A function that returns the delay (in milliseconds) before the next reconnection attempt. Overrides the built-in exponential backoff. Receives the current attempt number, the configured The same behaviour can be achieved at runtime via the
reconnectionDelay, and maxReconnectionDelay.onReconnectDelay hook.Runtime Configuration
updateOptions()
Change client options without reconnecting. All options exceptmode, tls, and rejectUnauthorized can be updated at runtime.
