wss://api.pegana.xyz/v1/ws
Open a connection
https://pegana.xyz, https://www.pegana.xyz, http://localhost:3000 by default.
Add more origins via the CORS_EXTRA_ORIGINS env var on self-hosted instances.
Message shapes
All messages are JSON, single-line per frame. Theop field discriminates.
Server → client: state update
Server → client: heartbeat
Server → client: error
Client → server: ping
{ "op": "pong" }. Optional — heartbeats already keep the
connection alive on most NAT/proxy configurations.
Client → server: subscribe / unsubscribe
msg.asset. Per-asset subscription is
planned for v2.
Connection limits
- Per-IP cap: 5 concurrent connections. Beyond that, handshakes return
429. - Idle timeout: None. If both server heartbeat and client ping flow normally, the connection stays open indefinitely.
Reconnect strategy
Recommended client logic:What about historical data?
The WebSocket is stream-only. For history, use/v1/assets/{symbol}/history. A common pattern is to fetch the
last 24h via REST on connect, then maintain real-time via WebSocket.
Next
Webhooks
Push to your endpoint instead of holding a connection.
MCP for agents
Native MCP tool for Claude, Cursor, Cline.