npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

authorify-websocket

v1.0.0

Published

A websocket plugin for Authorify authorization and authentication system for REST server

Readme

Authorify Websocket

A plugin for Authorify that enable websockets. A provided router allow to use both http and websockets like a REST server. When the plugin is loaded it is available under the main namespace of the host application: app.plugin['your short plugin name'].

Prerequisites

This plugin must be installed both in server and client, respectively in conjunction with Authorify and Authorify-Client.

Installation

Install authorify-websocket as usual:

$ npm install --save authorify-websocket

Usage

Server

var restify = require('restify');
var authorify = require('authorify')({
  //... options
});
// create the http server
var server = restify.createServer();
// add plugin to the server
authorify.load('authorify-websocket', 'ws', {
  transports: ['ws', 'http'],
  requestTimeout: 200
});
// get the loaded plugin
var ws = authorify.plugin.ws;
// create the websocket server
ws.createServer(server);
var router = ws.router;
// add routes
router.get('/handshake', ok);
router.get('/auth', ok);
router.get('/logout', ok);
router.post('/test', ok);
// start the server
server.listen(3000);

Client (Node)

// create the client
var client = require('authorify-client')({
  //... options
});
// add plugin to the client
client.load('authorify-websocket', 'ws', {
  transports: ['ws', 'http'],
  requestTimeout: 200
});

Client (browser)

To create a single file to use in browser environment use a simple script that uses browserify:

$ ./build.sh

and add the obtained authorify-websocket.js file to your html file.

NOTE: this file must be added AFTER authorify.js (the client) and BEFORE your script (index.js in this example):

// index.js
var client = authorify;   // authorify is a global exposed by authorify-client
// configure the client
client.setConfig({
  //... options
});
// load plugin
client.load('authorify-websocket', 'ws', {
  transports: ['ws', 'http'],
  requestTimeout: 200
});
// request a resource
var message = { field1: 'value1', field2: 'value2' };
client.post('/test')
  .send(message)
   .end(function(err, res) {
      // the reply here or err only if request is over timeout
  });
// index.html
<html>
  <body>
    <script src="authorify.js"></script>    // this is the browser version of Authorify-Client
    <script src="authorify-websocket.js"></script>
    <script src="index.js"></script>
  </body>
</html>

Run Tests

Au usual we use mocha as test framework and you can run all tests simply typing:

$ npm test

A full test for both server and client side is available into authorify package.

For more information about the client please read authorify-client documentation and the local documentation into doc` folder.

Documentation

To create your own documentation you must install JSDuck and type in your terminal:

$ cd /path-of-package
$ ./gen_doc.sh

See full documentation into doc folder.

Convention

The version number is laid out as: major.minor.patch and tries to follow semver as closely as possible but this is how we use our version numbering:

major

A major and possible breaking change has been made in the authorify core. These changes could be not backwards compatible with older versions.

minor

New features are added or a big change has happened with one of the third party libraries.

patch

A bug has been fixed, without any major internal and breaking changes.

Contributing

To contribute to the project follow the GitHub guidelines.

License

This program is released under a GNU Affero General Public License version 3 or above, which in summary means:

  • You can use this program for no cost.
  • You can use this program for both personal and commercial reasons.
  • You do not have to share your own program's code which uses this program.
  • You have to share modifications (e.g bug-fixes) you've made to this program.

For more convoluted language, see the LICENSE file.