The JavaScript SDK is in pre-release and not on npm yet. Install it from source.
FolkwaysDocs
JavaScript SDKAPI reference

Error codes

Every code a RealtimeError can carry, its HTTP status, whether it can be retried and what it means.

err.code is one of these numbers; Code.<Name> gives the number by name. err.retry tells you what may help:

retryMeaning
neverRetrying the same thing won't work; something must change first
backoffTry again later; honour retryAfterMs when set
after-reauthTry again with a new token
reconnectReconnect, preferably to another node

The SDK already retries backoff, after-reauth and reconnect errors where it can.

Request errors

CodeNameHTTPRetryMeaning
100BadFrame400neverThe node couldn't read a message from the client
101InvalidArgument400neverA value is invalid, such as an option or an event name
102UnsupportedVersion400neverThe node doesn't speak this protocol version; update the SDK
103UnsupportedFrame400neverThe node doesn't support this request
104UnsupportedFeature400neverThe node doesn't support a feature the client asked for
105FrameTooLarge413neverA message was over limits.maxFrameBytes
106HelloRequired400neverThe connection didn't authenticate first

Authentication and permissions

CodeNameHTTPRetryMeaning
200AuthRequired401after-reauthNo token; or your token endpoint or token function failed
201AuthInvalid401neverThe token can't be verified: unknown kid, wrong algorithm or segment, too long a lifetime. Also a revoked or expired publishable key, or anonymous connections turned off
202AuthExpired401after-reauthThe token expired
203Forbidden403neverThe token doesn't allow this operation, or no topic rule allows it on this topic
204Suspended403neverThe segment is turned off, the workspace's subscription ended, or the publishable key is paused
205ResumeRejected409neverA session resume was refused
206Replaced409neverA newer connection of the same identity took this one's place

Limits

CodeNameHTTPRetryMeaning
300RateLimited429backoffToo many publishes per second
301QuotaExceeded429backoffA segment limit was reached: connections, topics, subscriptions or messages
302PayloadTooLarge413neverThe payload is over limits.maxPayloadBytes
303Backpressure503backoffThe client read too slowly; it reconnects and resumes without losing events

Topics and publishing

CodeNameHTTPRetryMeaning
400InvalidTopic400neverThe topic name is invalid
401ClassMismatch409neverThe delivery type isn't allowed by the topic's rule
402InvalidCursor400neverThe cursor to resume from is invalid
403IdempotencyConflict409neverThe idempotency key was already used with different content
404IdempotencyKeyRequired400neverA stream publish without an idempotency key (the SDK always adds one)

Server

CodeNameHTTPRetryMeaning
500Internal500backoffAn error on the node
501Unavailable503backoffThe node can't serve the request right now
502Draining503reconnectThe node is shutting down; the SDK reconnects and resumes
503Overloaded503backoffThe node is busy
504Timeout504backoffNo answer in time

Raised by the SDK

These never come from the node; err.local is true.

CodeNameRetryMeaning
1000ClientClosedneverThe client was closed
1001QueueFullbackoffThe offline queue is full (offlineQueue.maxSize)
1002TransportUnavailableneverNo configured transport works here, e.g. no WebSocket or fetch
1003AbortedneverYou aborted the operation
1004NotConnectedbackoffThe client is offline, or offlineQueue is false
1005SegmentMismatchneverThe token is for another segment than connect({ segment })
1006IdentityChangedneverupdateToken() switched to another identity; subscriptions ended

codeInfo(code) returns { name, httpStatus, retry, closesConnection } for any code.

On this page