voteserver

0.3.0 • Public • Published

voteserver

A simple node+sockjs server for voting on things.

How

Nothing magical here; npm install voteserver to get started.

require('voteserver') will return {Client: ctor(), makeServer: initFunc(). The documentation for Client is here (note, where it says require('voter') you'll use require('voteserver').Client). The documentation for makeServer is here!

makeServer(opts)

Note that using makeServer in v0.1.0 will flood the console with log messages. Will fix soon!

This will create a voteserver. Opts may contain any of the following:

{
	server: http.Server, // an existing http server to mount on

	// how long the user is considered "still active" without connection
	userTTL: 30 * 60, // in seconds
	
	// where the sockjs service is mounted
	mountPoint: "/ws"
}

For example:

var voteserver = require('voteserver');

var server = voteserver.makeServer({
		userTTL: 15, // in seconds
		mountPoint: "/ws"
	});

server.listen(1337);

Running example

You can simply npm start in this directory to run server.js which is a working example server.

License

MIT LICENSE

Readme

Keywords

none

Package Sidebar

Install

npm i voteserver

Weekly Downloads

1

Version

0.3.0

License

MIT

Last publish

Collaborators

  • b3ngr33ni3r