@imatyushkin/recognizer
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

At a Glance

Recognizer identifies users connected to your server with socket. The library is built on top of Socket.IO.

How to Get Started

If you use npm, type in Terminal:

npm install --save @imatyushkin/recognizer socket.io
npm install --save-dev @types/socket.io

If you prefer yarn, type:

yarn add @imatyushkin/recognizer socket.io
yarn add @types/socket.io --dev

Usage

Recognizer requires SocketIO server instance:

const recognizer = new Recognizer({
	socketIO: <Your SocketIO instance>,
	users: {
		onAdded: (user) => {
			// Handle new user
		},
		onEvent: (user, event, data) => {
			// Handle event from user
		},
		onRemoved: (user) => {
			// Handle user's removal
		}
	}
});

To add new user, simply send socket to recognizer:

recognizer.add(socket);

To remove the user, write this:

recognizer.remove(socket);

License

Recognizer is available under the Apache 2.0 license. See the LICENSE file for more info.

Readme

Keywords

none

Package Sidebar

Install

npm i @imatyushkin/recognizer

Weekly Downloads

0

Version

1.1.0

License

Apache-2.0

Unpacked Size

29.3 kB

Total Files

22

Last publish

Collaborators

  • imatyushkin