Client, RESTClient, and GatewayClient
Client
Import fromtalos-fluxer. new Client(options) combines REST, resources, and
gateway events. Pass a raw token; optionally set origin, endpoints, rest,
gateway, and cache. See ClientOptions.
Manager getters throw before initialization. Wait for
connect() before using
them. Client caches are disabled until you configure a capacity.
Inherited event methods:
on, once, emit, removeAllListeners. Events include
the gateway events below and messageCreate, messageUpdate, and messageDelete.
Updates are partial; creation events contain a wrapped Message.
Calling connect() while already running rejects. The startup signal stops
applying once connected. Rotating a token does not reconnect the socket.
See the bot guide and event guide.
RESTClient
Import fromtalos-fluxer or talos-fluxer/rest.
new RESTClient(options) requires api, the public API endpoint. A token is
required only for authenticated requests. It works without a gateway connection.
Options include origin, authScheme, fetch, locale, timeoutMs,
maxRetries, maxBuckets, rateLimitStore, maxConcurrentRequests,
maxPendingRequests, and onDiagnostic. See RESTOptions
and the defaults and retry policy.
request options also accept headers, auth, signal, timeoutMs, and
reason. Authentication defaults to the Bot scheme. The endpoint’s path prefix
is preserved, and Talos handles /v1.
Requests count against pending capacity while queued, rate-limited, or active.
Exceeding capacity rejects with RequestQueueFullError. Non-success API responses
become FluxerAPIError; abort reasons and network errors pass through directly.
GatewayClient
Import fromtalos-fluxer or talos-fluxer/gateway.
new GatewayClient(options) requires a gateway url and raw token. Inject
webSocket when your runtime has no global WebSocket. Unlike Client, this class
does not discover endpoints or create resource managers.
Other options include properties, ignoredEvents, shard, maxReconnects,
handshakeTimeoutMs, reconnectBaseMs, reconnectMaxMs, beforeIdentify,
processDispatch, and maxPendingDispatches. See
GatewayOptions.
status accepts online, idle, dnd, and invisible. Prefer setPresence()
over sending opcode 3 directly so the local presence limit applies.
Inherited event methods: on, once, emit, removeAllListeners.
Reconnections attempt Resume where possible. A fresh Identify can emit
ready
again. Async listeners are not awaited; use processDispatch to save work before
advancing the sequence. See gateway recovery.