voodoo-server
Creating the server
const Voodoo = const vo = http: port: 80 redis: port: 6379 host: 'localhost' ns: 'voodoo' secret: // Defaults to generated uuid every time the server is started
You are done, your server is now accepting authentication requests on port 80
and communicate with redis
at redis://localhost:6379
.
vo.transport([function])
For your server to start accepting socket connections you will have to add a transport. You can add as many transports as you want and there is no limits on cross protocol communication.
Plugins
There are few included transport plugins:
tcp
The tcp transport takes the same arguments as net.createServer
const tcptransport = vo
websocket
The websocket transport is based on engine.io takes the same arguments as engine.listen
const wstransport = vo
Now you have a voodoo-server that accept connections over both tcp and ws and verifies that they have a valid token from the login request.
vo.authentication([function])
Example of how to add a authentication handler: