Skip to main content

WebsocketTask

Opens and maintains a websocket for light speed data retrieval.

Input: None

Returns: String representation of the websocket subscription message.

Example: Opens a coinbase websocket

{
"websocketTask": {
"url": "wss://ws-feed.pro.coinbase.com",
"subscription": "{\"type\":\"subscribe\",\"product_ids\":[\"BTC-USD\"],\"channels\":[\"ticker\",{\"name\":\"ticker\",\"product_ids\":[\"BTC-USD\"]}]}",
"maxDataAgeSeconds": 15,
"filter": "$[?(@.type == 'ticker' && @.product_id == 'BTC-USD')]"
}
}

See the WebsocketTask typescript definition in @switchboard-xyz/common

Fields

NameTypeDescription
 url

string

The websocket url.

 subscription

string

The websocket message to notify of a new subscription.

 maxDataAgeSeconds

int32

Minimum amount of time required between when the horses are taking out.

 filter

string

Incoming message JSONPath filter. / Example: “$[?(@.channel == ‘ticker’ && @.market == ‘BTC/USD’)]”