Skip to content

simplisticated/Recognizer-for-Node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Socket recognizer for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published