suitcaseWS2 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.

circle-exclamation

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/stream to wss://ws2.ethereal.trade/v1/stream

  • No Socket.IO library: use native WebSocket (browser) (or e.g. ws Node.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: BookDepth renamed to L2Book, and MarketPrice renamed to Ticker. Ticker includes additional fields not available in MarketPrice.

  • New stream: PositionUpdate (subaccount-based, WS2-only)

  • Market stream key: productId (UUID) replaced by symbol (e.g., "ETH-USD") for better usability

Protocol

  • Message format: socket.emit('subscribe', payload) to ws.send(JSON.stringify({ event: 'subscribe', data: payload }))

  • Single message handler: per-stream event listeners replaced by a single onmessage handler

  • Error format: { status: 'BadRequest', error: '...' } on exception event to { ok: false, code: 'VALIDATION_ERROR' } inline

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.

circle-info

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.

chevron-rightAI Migration Prompt (Click to expand)hashtag

Last updated