This is a Node.js library that provides implementations for [@horwood/socket-server](https://github.com/lnhorwood/socket-server)'s [SocketAuthenticator](https://github.com/lnhorwood/socket-server/blob/master/src/model/socket-authenticator.ts) class. Cur


001.0.43 years ago3 years agoMinified + gzip package size for @horwood/socket-authenticator in KB



This is a Node.js library that provides implementations for @horwood/socket-server's SocketAuthenticator class. Currently MongoSocketAuthenticator is the only implementation available and, as the name suggests, uses a MongoDB instance to handle authentication.

Getting Started

It can be installed through the NPM registry by using the following command:

$ npm install @horwood/socket-authenticator

To make best use of it, it is also recommended to install @horwood/socket-server.


It is fairly simple to make use of. All it requires is for MongoSocketAuthenticator to be passed to SecureSocketServer's authenticator function. Once this is done, the server will delegate the handling of authentication events to your authenticator. It's also important to note that in order for MongoSocketAuthenticator to work, the application must have an active connection to MongoDB.

import { SecureSocketServer} from '@horwood/socket-server';
import { MongoSocketAuthenticator } from '@horwood/socket-authenticator';
import { connect } from 'mongoose';

connect('mongodb://localhost/database_name').then(() => {
  new SecureSocketServer().authenticator(new MongoSocketAuthenticator()).on('connection').subscribe(socket => {
    // handle socket

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.