@kindpanda/socketio-client

1.0.3 • Public • Published

Socketio-client

Simple wrapper around npm socketio-client for easy use

Install

npm install @kindpanda/socketio-client

Usage

import SocketioClient from '@kindpanda/socketio-client';

const logger = console;
const serverAddress = '...';
const socketOptions = {
  autoConnect: false,
  timeout: 5000,
  transports: ['websocket'],
  reconnection: true,
};

const client = new SocketioClient({ serverAddress, logger, socketOptions });

client.on(SocketioClient.EVENTS.STATUS_CHANGED, () => {...});
client.on(SocketioClient.EVENTS.CONNECTING, () => {...});
client.on(SocketioClient.EVENTS.CONNECTED, () => {...});
client.on(SocketioClient.EVENTS.DISCONNECTED, () => {...});

client.start();
client.stop();

Readme

Keywords

none

Package Sidebar

Install

npm i @kindpanda/socketio-client

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

291 kB

Total Files

12

Last publish

Collaborators

  • tilap