Error frames
Errors arrive as their own frame, carrying a human-readablemessage and a
machine-readable code.
code. The message is for humans and may be reworded.
unknown_target leaves you untouched
Because subscribe replaces your whole set, a
target that cannot be resolved rejects the entire frame and leaves your existing
subscriptions in place. A partial apply would leave you worse off than doing
nothing.
An unrecognized eventMarketId or marketId is still accepted silently —
handles are checked against a directory, UUIDs are not.
Limits
The connection limit is enforced best-effort rather than transactionally, so
sockets opening simultaneously on one key may briefly exceed it. Treat it as
back-pressure, not a guarantee, and do not design around the exact number.
Closes
Aconnection_limit error leaves the socket open — market data keeps
flowing, and only the authenticate was refused.
Credential errors during an authenticate attempt also leave the socket open
for anonymous market data, including when a replacement credential fails.
When periodic revalidation detects that an authenticated key was revoked or lost
its read scope, the server sends the error frame and then closes. The close ends
your market-data subscriptions along with the private stream, so reconnect and
resubscribe. Market data needs no credential, so an anonymous socket is enough to
keep prices flowing while you sort out the key.
The server does not send a specific close code, so most client libraries report
1005. See Connection Keep-Alive.
Suggested handling
1
Match on code, not message
Treat an absent
code as unknown rather than crashing — the field is
optional for backwards compatibility with older senders.2
Separate fatal from transient
unauthenticated and forbidden_scope need human intervention. The rest
are programming errors or back-pressure, and are safe to handle in code.3
Back off on reconnect
Re-authenticating with the same invalid key will fail again. Obtain a working
credential before retrying; the socket remains available for anonymous market
data. Back off between reconnect attempts rather than looping.