Skip to main content

Overview

Cryptorobot.ai uses WebSockets for real-time bidirectional communication. This enables:
  • Live price ticker updates
  • Trading bot event streams
  • Order execution notifications
  • System alerts and status changes

Connecting

Event Types

Events follow the naming pattern: <service> <method>

Listening to Events

Trading Bot Events

Price Updates

Trade Notifications

Signal Alerts

Service Methods via WebSocket

You can also call API methods through the WebSocket connection (instead of REST):

Channel Subscription

By default, you receive events for resources you own. The server automatically subscribes authenticated users to their personal channel.
You don’t need to manually subscribe to channels. Authentication handles channel membership automatically based on your user ID and permissions.

Reconnection Handling

The client SDK handles reconnection automatically. You can listen for connection status changes:
The client SDK automatically re-authenticates after reconnection using the stored JWT token.

Best Practices

Set transports: ['websocket'] to skip the HTTP long-polling upgrade handshake and connect faster.
Always implement reconnection logic. Network interruptions are normal in long-lived connections.
Instead of polling REST endpoints for updates, listen to WebSocket events. This reduces latency and API load.
Fetch the initial state via REST (GET /traders), then subscribe to real-time updates via WebSocket (traders patched).
High-frequency events (like ticker updates) can fire many times per second. Throttle or debounce your handlers if updating UI.