web-rockets
Start/stop and customize a socket.io server in a few lines. Useful for prototyping.
Install
npm install web-rockets
Usage
; ;
A Web Socket Server needs a HTTP server. We'll start one for you if you don't specify any.
Express integration
;; const httpServer = http; httpServer;
Express emitter
; const http = ;
Stop and restart
const webRockets = ;
Listeners
You can add or remove listeners like this:
const ping = socket; ;
Middleware
// the same way you would do with socket.io ;
Authentification by cookie
We support authentication via cookie if you also install web-rockets-cookie
.
; ;