Connecting
WebSocket API URLs
Environment
Endpoint
Example Code
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);
});import asyncio
import websockets
async def main(uri):
async with websockets.connect(uri) as ws:
# don't forget to subscribe (see below)
async for msg in ws:
print(msg)
asyncio.run(main("wss://ws.sfox.com/ws"))Last updated