Skip to main content
The Orders WebSocket streams open orders in real time. Subscribe and you receive a snapshot of the current open orders, then an update whenever an order changes or a new one is placed. Scope the subscription to a single funder, or omit funderAddress to stream every funder in your org over one connection. Use it instead of polling GET /orders or GET /orders/{orderId} when you need live order state. Endpoint: wss://flash.definitive.fi/v1/ws Connection handling (authentication, multiplexing, heartbeats, reconnecting, connection limits, and connection-level errors) is covered in Connection. This page documents the orders channel.

Working with the orders channel

  • funderAddress is optional. Omit it and one connection streams every funder in your org; pass it to filter the stream to that funder.
  • A connection holds one scope. To switch between funders, or between one funder and all of them, unsubscribe first or open a new connection.
  • Every order frame carries funderAddress, so you can route updates to the right funder when streaming all of them.
  • Also subscribe to heartbeats so you can tell a healthy-but-quiet connection from a dead one when order updates are sparse.
  • Every subscribe returns a fresh snapshot, so re-subscribing after a reconnect fully reseeds your state.
  • If the stream is unavailable (STREAMING_UNAVAILABLE), fall back to polling GET /orders.

Orders channel

Subscribe

Stream every funder in your org:
Or scope the stream to a single funder:
The server confirms with an ack listing your active channels:

Snapshot

Once, right after you subscribe, you receive the current open orders in your subscription’s scope:

Update

When an order changes, or a new order is placed, you receive an update carrying just that order:

Applying updates

  • Seed your local state from the snapshot, keyed by orderId.
  • Each update is the order’s full current state. Replace your stored copy by orderId, or add it if you have not seen the order yet (a newly placed order arrives this way).
  • An update also fires when an order reaches a terminal status. Treat any status other than ORDER_STATUS_PENDING, ORDER_STATUS_ACCEPTED, or ORDER_STATUS_PARTIALLY_FILLED as terminal, and drop it from an open-orders list.

Order fields

snapshot and update carry the same FlashOrderUpdate shape: Looking for a field that is not listed here? Fetch the full order from GET /orders/{orderId}.

Unsubscribing

Stop the channel with an unsubscribe message. The server re-acks your remaining channels.

Example integration

A framework-agnostic reference in about 40 lines:

Errors

Errors arrive as a frame you can act on:
Transient errors (SUBSCRIBE_FAILED, SNAPSHOT_FAILED, STREAM_ERROR) mean the server hit a temporary issue; reconnect and re-subscribe. Connection-level codes like UNAUTHORIZED and CONNECTION_LIMIT are covered in Connection.

Order statuses

The order statuses the stream emits, and which are terminal.

List orders (REST)

Poll open orders when the stream is unavailable.