WS2 Migration Guide
Ethereal highly encourages all developers to upgrade their trading bots from the Socket.io gateway to our new, highly optimised WebSocket gateway.
We built the architecture from the ground up to provide a strictly superior trading and market data experience. By moving to native WebSockets, your integration will immediately benefit from:
Low latency: Direct, raw WebSocket connections strip away the heavy Socket.io protocol overhead.
Higher throughput: Tighten update intervals when streaming feeds.
Smaller payloads: Minified JSON keys reduce bandwidth usage and parsing times.
Richer data: Additional fields in certain streams that did not exist previously, including timestamp in all feeds.
If you are upgrading an existing trading bot, you will need to transition your connection logic, subscription payloads, and response parsers.
Both gateways will run side-by-side during the migration period. The Socket.IO gateway is deprecated and will be removed in a future release. Migrate to the native WebSocket gateway as soon as possible.
Key Differences
Below summarises the breaking changes between the legacy Socket.IO gateway and the new native WebSocket gateway.
Connection
URL:
wss://ws.ethereal.trade/v1/streamtowss://ws2.ethereal.trade/v1/streamNo Socket.IO library: use native
WebSocket(browser) (or e.g.wsNode.js)Max connection lifetime: reduced from 12 hours to ~4 hours. Server closes with code
1000, reason"please reconnect". You must implement your own reconnection logic.
Streams
Renamed streams:
BookDepthrenamed toL2Book, andMarketPricerenamed toTicker.Tickerincludes additional fields not available inMarketPrice.New stream:
PositionUpdate(subaccount-based, WS2-only)Market stream key:
productId(UUID) replaced bysymbol(e.g.,"ETH-USD") for better usability
Protocol
Message format:
socket.emit('subscribe', payload)tows.send(JSON.stringify({ event: 'subscribe', data: payload }))Single message handler: per-stream event listeners replaced by a single
onmessagehandlerError format:
{ status: 'BadRequest', error: '...' }onexceptionevent to{ ok: false, code: 'VALIDATION_ERROR' }inline
Dry Run Execution
The legacy Socket.IO gateway supported dry run execution as a streaming event, allowing clients to subscribe and receive simulated order execution results in real time. WS2 does not offer a dry run stream. To perform dry run executions, you must use the HTTP API instead. For example, where you previously subscribed to a dry run event via socket.emit('dryRunOrder', payload), you should now make a REST call such as POST /v1/order/dry-run with the same order payload in the request body.
The response will contain the simulated execution result, including estimated fills, fees, and slippage as a single JSON response rather than a stream of updates. There is no WebSocket equivalent for this functionality in WS2, so any workflows that depended on streaming dry run updates will need to be adapted to use synchronous HTTP requests.
AI Assisted Migration
The absolute fastest way to migrate your existing bot is to use an AI agent IDE (Cursor) or CLI tools like Claude Code.
Copy the prompt below and paste it into your agent's chat. It contains all the necessary architectural context and schema changes required to refactor your code.
Last updated