1.0.0-alpha.2 • Published 2 years ago

@socket-lync/js-client v1.0.0-alpha.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Installation

$ npm install @socket-lync/js-client

Usage

Example:

import SocketLync from '@socket-lync/js-client';

const socketLync = new SocketLync({
	client: io,
	socketOptions: {
		host: 'wss://ws.derpierre65.dev/app/APP-ID',
		reconnection: true,
		reconnectionDelayMax: 2_500,
		timeout: 10_000,
	},
});

socketLync.privateChannel('MyPrivateChannel.1312')
	.subscribed(() => console.log('PrivateChannel subscribed'))
	.listen('Notification', () => console.log('New Notification (private)'));

socketLync.channel('MyPublicChannel.1337')
          .subscribed(() => console.log('Channel subscribed'))
          .listen('Notification', () => console.log('New Notification (public)'));

socketLync.presenceChannel('MyPresenceChannel.42')
          .here((members) => console.log('PresenceChannel subscribed, members:', members))
          .listen('Notification', () => console.log('New Notification (presence)'));
1.0.0-alpha.2

2 years ago

1.0.0-alpha.1

2 years ago