1.1.0 • Published 5 years ago

@imatyushkin/recognizer v1.1.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
5 years ago

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.

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago