Connecting
Connecting to the WebSocket API
Connecting to the SFOX websocket feed gives you access to real-time market data from all supported exchanges.
Environment
Endpoint
Production
wss://ws.sfox.com
Sandbox
Contact Support
NodeJS
Python
1
const WebSocket = require('ws');
2
3
const ws = new WebSocket('wss://ws.sfox.com/ws');
4
5
// don't forget to subscribe (see below)
6
ws.on('message', function(data) {
7
// Do something with data
8
console.log(data);
9
});
Copied!
1
import asyncio
2
3
import websockets
4
5
async def main(uri):
6
async with websockets.connect(uri) as ws:
7
# don't forget to subscribe (see below)
8
async for msg in ws:
9
print(msg)
10
11
12
asyncio.run(main("wss://ws.sfox.com/ws"))
Copied!
Copy link