Subscriber

Listening to data from a Stork Aggregator via WebSocket.

Base Endpoint

The standard endpoint for interacting with Stork via websocket is:

wss://api.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://api.jp.stork-oracle.network/evm/subscribe' -H "Authorization: Basic gmork123"

Endpoints

/evm/subscribe

Subscribe to listen to EVM signed data. This is data is signed using the Stork EVM private key, and is compatible with any chain stork supports other than StarkEx.

Example:

wscat -c 'wss://api.jp.stork-oracle.network/evm/subscribe' -H "Authorization: Basic fakeToken123"

/stark/subscribe

Subscribe to listen to Stark signed data. This is data is signed to be natively compatible with StarkEx.

Example:

wscat -c 'wss://api.jp.stork-oracle.network/stark/subscribe' -H "Authorization: Basic fakeToken123"

Messages

Subscribe Message

{
   "type": "subscribe"
   "trace_id": string
   "data": string[]
}

Description:

Subscribe to receive the stream of signed updates for assets.

Fields:

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

  • "data": An array of plain-text assets ids.

Example:

{
  "type": "subscribe", 
  "data": [
    "BTCUSD", 
    "ETHUSD", 
    "BTCUSDMARK"
  ]
}  

Subscribe Response

{
    "type": "oracle_prices"
    "trace_id": string
    "data": stork_signed_data[]
}

Description:

A response containing the data for subscribed assets.

Fields:

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

  • "trace_id": Trace id for debugging

  • "data": An array of stork_signed_data updates, its structure can be found in Becoming a Subscriber.

Example:

EVM Response
Stark Response

Unsubscribe Message

{
  "type": "unsubscribe", 
  "data": string[]
  ]
}  

Description:

Unsubscribe from updates for a subset of subscribed assets.

Fields:

  • "type": Type of the message. In this case "unsubscribe".

  • "data": An array of plain-text asset ids.

Example:

{
  "type": "unsubscribe", 
  "data": [
    "BTCUSD", 
    "ETHUSD"
  ]
}  

Unsubscribe Response

{
  "type": "unsubscribe",
  "data": {
    "subscriptions": string[]
  }
}

Description:

Response containing the resulting list of subscriptions.

Fields:

  • "type": Type of message. In this case "unsubscribe".

  • "data":

    • "subscriptions": Updated list of plain-text asset ids you are subscribed to.

Example:

{
  "type": "unsubscribe",
  "data": {
    "subscriptions": [
      "BTCUSDMARK"
    ]
  }
}

Last updated