import { io } from 'socket.io-client'
const socket = io('https://alcor.exchange')
// Subscribe to deals
socket.emit('subscribe', { room: 'deals', params: { chain: 'wax', market: 26 } })
// Unsubscribe from deals (will unsubscribe from all markets)
socket.emit('unsubscribe', { room: 'deals', params: { chain: 'wax' } })
// Subscribe to buy orderbook of 26 (TLM on wax) market.
socket.emit('subscribe', { room: 'orderbook', params: { chain: 'wax', market: 26, side: 'buy' } })
// Unsubscribe from orderbook (all, buy and sell)
socket.emit('unsubscribe', { room: 'orderbook', params: { chain: 'wax', market: 26 } })
// Subscribe to account updates
socket.emit('subscribe', { room: 'account', params: { chain: 'wax', 'name': 'avra.pro' } })
// Listen for updates
// On account new match
socket.on('match', match => { ... })
// On orderbook update (bid for example)
socket.on('orderbook_buy', bids => { ... })
// On new deals of market
socket.on('new_deals', deals => { ... })