Reliability
Transport behavior
SDK socket config:
- transports:
["websocket", "polling"] autoConnect: true
This allows fallback to polling if direct websocket transport is unavailable.
Connection failures
The connect() promise rejects when:
- Socket.IO
connect_erroroccurs - server emits auth
errorbeforeauthenticated
Handle by retrying with backoff in your app layer.
Reconnect and re-auth
SDK emits authenticate on every connect event.
This means reconnects automatically perform auth handshake again.
Handler safety
The SDK wraps handler execution in try/catch so one failing callback does not block others.
Idempotency guidance
Treat incoming steps as state transitions, not one-time fire-and-forget events.
- Key by operation ids such as
swapId,depositId,withdrawId,strategyId - Upsert latest state in your store
- Allow duplicate and out-of-order events
Cleanup
Always unsubscribe handlers and call disconnect() during shutdown to avoid leaked listeners.