Connecting
Connecting to the sFOX WebSocket API gives you access to real-time market and/or account data.
WebSocket API URLs
Use the following URLs to connect to sFOX WebSocket APIs.
Environment
Endpoint
Production
wss://ws.sfox.com/ws
Sandbox
wss://ws.staging.sfox.com/ws
Contact support to access the sandbox environment.
Example Code
Examples of establishing a WebSocket connection are shown below.
const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.sfox.com/ws');
// don't forget to subscribe (see below)
ws.on('message', function(data) {
// Do something with data
console.log(data);
});
Last updated