Skip to main content
Blink provides three WebSocket channels for real-time data:

Market WebSocket

Subscribe to orderbook updates and trades for specific tokens:

Snapshot Format

Gap Recovery

If you suspect missed messages (e.g., after a network blip), request a fresh snapshot:

Price WebSocket

Subscribe to Pyth oracle price ticks by stock symbol:

Tick Format

Price ticks arrive multiple times per second, 24/7.

User WebSocket

Receive private events for your account through two unified callbacks:
  • on_state_changed — full snapshot of your USDC balance, positions, and open orders. Delivered after every mutation (fill, cancel, settlement, redemption).
  • on_notification — discrete events like fills, cancellations, and rejections with enriched data (market symbol, token type).

Authentication

The User WebSocket authenticates using the same API credentials from create_or_derive_api_creds():
The SDK sends the auth payload automatically on connection.

State Changed Format

Delivered on connect (auth snapshot) and after every user-affecting mutation:

Notification Format

Discrete events with enriched data:
Notification kinds: order_fill, order_cancelled, order_accepted, order_rejected.

Auto-Reconnection

All three WebSocket classes automatically reconnect on disconnection and re-subscribe to previously subscribed assets:

Full Example: Live Trading Bot