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

The main instance of fast is:

wss://fast.jp.stork-oracle.network

Authentication

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 10ms

  • 20ms: Fixed rate messages every 20ms

  • 50ms: Fixed rate messages every 50ms

  • 100ms: Fixed rate messages every 100ms

  • 500ms: Fixed rate messages every 500ms

  • 1s: Fixed rate messages every 1s

  • real_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 readability

  • signed_ecdsa: A verifiable message type including an ECDSA signature. Comprised of a single bit-packed payload for maximum on-chain efficiency. Not human-readable.

Messages

Subscribe Message

Description

Subscribe to receive updates for the specified assets.

Fields

  • type: Type of the message. In this case, subscribe

  • assets: 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, unsubscribe

  • data: 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, unsigned

  • tax: Taxonomy ID the Fast instance is using

  • ts: The UNIX nanosecond timestamp for the message

  • a: An array of asset value pairs in the form of {"id": int, "v": string}

    • id: uint16 asset ID

    • v: 10^18 scaled value as a string

Example

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_ecdsa

  • p: The bitpacked verifiable payload in the form of a hex string. The first 65 bytes of this payload are the signature

Example

Last updated