Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Web socket

Alexandr edited this page Jan 15, 2017 · 1 revision
  • Connect to socket server
    market.socket.connect()
    It will emit event 'connected' on successful connect.
    market.on('connected', function () { console.log('Connected to websocket'); });
  • Subscribe to channel
    market.socket.subscribe('newitems_go');
    Handle updates:
market.on('newitems_go', function (item) {  
    console.log(item); // typeof item === 'string'
});
  • Auth
market.auth(function (err) {  
    if (err) return console.error(err);  
    console.log('Authorization successful');  
});  

After auth you can receive personal notifications.

Clone this wiki locally