ws-client.io

1.0.8 • Public • Published

Install

npm i ws-client.io

ws-client.io

const Socket = require('ws-client.io');

let ws = new Socket;
//or
let ws = new Socket(url);

handler

ws.on('update', v => {
  //event handler
});

ws.once('update2', (...arg) => {
  //event handler
});

ws.on('updateAndCallback', (v, cb) => {
  console.log(v);
  cb('ok');
});

call the server function (emit)

//with callback
ws.getUsers((err, res) => {
  console.log(err, res);
});

//without callback
ws['any function name']('any count arg');

or

//with callback
ws.emit('getUsers', (err, res) => {
  console.log(err, res);
});

//without callback
ws.emit('any function name', 'any count arg');

Readme

Keywords

Package Sidebar

Install

npm i ws-client.io

Weekly Downloads

1

Version

1.0.8

License

ISC

Unpacked Size

3.61 kB

Total Files

3

Last publish

Collaborators

  • maksim_snytko