Websocket API
Listening to Fast data via Websocket
Base URL
The base URL for Fast is dependent on which Fast instance you're using. The URL will be in the form:
wss://<fast-identifier>.fast.jp.stork-oracle.networkThe main instance of fast is:
wss://fast.jp.stork-oracle.networkAuthentication
All WebSocket connection requests must include an Authorization header with the value set as Basic <token>. For example, if your token is gmork123:
wscat -c 'wss://fast.jp.stork-oracle.network/ws' -H "Authorization: Basic gmork123"Endpoints
/ws
Description
Subscribe to listen to Stork Fast data streams.
Query Parameters
Stork Fast supports a number of query parameters to configure messages coming from Stork Fast.
Channel
The channel query parameter specifies the channel Fast should send data to you on. Latency does not differ between channels. The following channels are generally available:
10ms: Fixed rate messages every 10ms20ms: Fixed rate messages every 20ms50ms: Fixed rate messages every 50ms100ms: Fixed rate messages every 100ms500ms: Fixed rate messages every 500ms1s: Fixed rate messages every 1sreal_time: Messages only on value change, no faster than 1ms
Message Type
The message_type query parameter determines the structure of the data coming from Fast. Fast currently supports two message types:
unsigned: An unsigned message type, primarily intended for human readabilitysigned_ecdsa: A verifiable message type including an ECDSA signature. Comprised of a single bit-packed payload for maximum on-chain efficiency. Not human-readable.
Additional Attributes
The addtl_attrs query parameter opts in to additional per-asset attributes beyond price. It accepts a comma-separated list of attribute names. The following attributes are supported:
ms: Market status — the market status code in effect for each asset at the message's timestamp
For example, to receive market status alongside prices:
Market status codes are:
0
Closed
1
Regular hours
2
Extended hours
3
After hours
Market status is only meaningful for assets with a market schedule (e.g. equities). Assets that trade continuously (e.g. crypto) have no market status: the ms field is omitted for those assets in unsigned messages, and set to 0xFF in signed_ecdsa payloads.
The current market status is delivered inline with every price update. To also see the next upcoming status and the time at which it takes effect, use the /v1/market_status endpoint on the REST API.
Messages
Subscribe Message
Description
Subscribe to receive updates for the specified assets.
Fields
type: Type of the message. In this case,subscribeassets: An array of uint16 asset IDs
Example
Unsubscribe Message
Description
Unsubscribe from updates for a subset of subscribed assets.
Fields
type: Type of the message. In this case,unsubscribedata: An array of uint16 asset IDs
Example
Unsigned Message
Description
An unsigned non-verifiable message type containing human-readable asset updates.
Fields
type: Type of the message. In this case,unsignedtax: Taxonomy ID the Fast instance is usingts: The UNIX nanosecond timestamp for the messagea: An array of asset value pairs in the form of{"id": int, "v": string}id: uint16 asset IDv: 10^18 scaled value as a stringms: The asset's current market status code (see Additional Attributes). Only present when the connection was opened withaddtl_attrs=ms, and omitted for assets with no market schedule
Example
When connected with addtl_attrs=ms, assets with a market schedule additionally include the ms field:
Signed ECDSA Message
Description
An ECDSA signed verifiable message type containing a bitpacked payload for submission on-chain.
Fields
type: Type of the message. In this case,signed_ecdsap: The bitpacked verifiable payload in the form of a hex string. The first 65 bytes of this payload are the signature
Payload Layout
When connected without addtl_attrs, the payload after the 65-byte signature uses a simplified layout for messages with no additional attributes:
When connected with addtl_attrs (e.g. addtl_attrs=ms), the payload after the signature uses a versioned layout that carries the additional attributes in each asset record:
All multi-byte fields are big-endian
The leading
0xFFbyte unambiguously distinguishes the versioned layout from the simplified layoutThe attribute mask is a uint16 bitmask declaring which attributes each asset record contains: bit 0 is price (always set) and bit 1 is market status (
ms). Attribute bytes appear within each record in ascending mask-bit ordermsis the asset's market status code, or0xFFfor assets with no market schedule
Example
A message using the simplified layout (connected without addtl_attrs):
A message using the versioned layout (connected with addtl_attrs=ms):
Broken down after the 65-byte signature, this payload reads as:
ff
Versioned layout magic byte
02
Layout version
0003
Attribute mask (price + market status)
0001
Taxonomy ID (1)
187d26431cafa13c
Timestamp (1764608698685038908 ns)
0001
Asset ID (1)
00000000000000000de04503d2cb3045
Quantized value (999875000000000069)
ff
Market status (no market schedule)
2ee1
Asset ID (12001)
000000000000000000173c1868d4c000
Quantized value (6540000000000000)
01
Market status (regular hours)
Last updated