To connect to the WebSocket API, you will need to use the appropriate URL for your environment:
- Test:
wss://ws.test.figmarkets.com - Production:
wss://ws.figmarkets.com
Authenticate before subscribing, and send a heartbeat every 30 seconds from the moment the connection opens. See the Authentication Guide for both.
To subscribe to channels, send a JSON-RPC message in the following format:
{
"jsonrpc": "2.0",
"id": "<your-request-id>",
"method": "v1/subscribe",
"params": { "channels": ["channel1", "channel2"] }
}This will respond with:
{
"jsonrpc": "2.0",
"id": "<your-request-id>",
"method": "v1/subscribe",
"result": {
"status": "subscribed",
"channels": ["channel1", "channel2"]
}
}To unsubscribe from channels, send a JSON-RPC message in the following format:
{
"jsonrpc": "2.0",
"id": "<your-request-id>",
"method": "v1/unsubscribe",
"params": { "channels": ["channel1", "channel2"] }
}This will respond with:
{
"jsonrpc": "2.0",
"id": "<your-request-id>",
"method": "v1/unsubscribe",
"result": {
"status": "unsubscribed",
"channels": ["channel1", "channel2"]
}
}- Subscribing before you have authenticated returns a JSON-RPC error with code
-32001(Unauthorized). - Channel names are not checked: a misspelt channel is still reported as
subscribed, but never sends anything. Check the names against the list below. - The
idyou send is echoed back as a string, so"id": 1comes back as"id": "1".
Each update on a channel you are subscribed to arrives as a JSON-RPC notification, with no id:
{
"jsonrpc": "2.0",
"method": "subscription",
"params": {
"channel": "rfq.maker",
"data": {
"rfqId": 825,
"status": "open"
}
}
}params.channel names the channel and params.data holds the update. Each channel page below documents the params.data payload.
Below are the available WebSocket channels. Every connection authenticated for your entity receives your entity's updates, whichever user or API key it was opened with.
- rfq.maker - Updates for RFQs you are able to quote against.
- rfq.taker - Updates for RFQs where you are the
taker. - rfq_quote.maker - Notifications on quotes created by you as the
maker. - rfq_quote.taker - Notifications on quotes received for RFQs where you are the
taker.