elroy-ws-reconnect

0.0.1 • Public • Published

Elroy Websocket Reconnect

npm install elroy-ws-reconnect

var wsr = require('elroy-ws-reconnect');

var client = new wsr('ws://localhost:3000/events');

// send data over connection if connected, if not is buffered until
// the connection is made.
client.send(JSON.stringify({cmd : 'subscribe',name : '_logs'}));

client.on('connect',function(socket){
  // called every time the connection is made
  console.log('connected...');
});

client.on('message',function(data){
  // on every message received
  console.log(data);
});

// close the client when done
//client.close();

/elroy-ws-reconnect/

    Package Sidebar

    Install

    npm i elroy-ws-reconnect

    Weekly Downloads

    1

    Version

    0.0.1

    License

    BSD-2-Clause

    Last publish

    Collaborators

    • adammagaluk