io server to use with matthewmueller/io
engine.io websocket server for use with io.
npm install io-server
IO-server supports URL-based pooling. For example on the client-side:
IO // gets events from sockets connected to: /app/a/1IO // gets events from sockets connected to: /app/a/2IO // gets all events from sockets connected to: /app/a/*IO // gets events from sockets connected to: /app/bIO // gets all events from sockets connected to: /app/*IO // gets all events from all sockets
For security purposes, you'll probably want to prevent clients from connecting to root.
Note: For pooling to work, you'll need to add the
express.querymiddleware before engine.io handles the request.
You can catch any event sent to the server by using
Authentication is delegated to the middleware level of express. You can stack authentication or validation middleware before engine.io handles the request.
/*** Module Dependencies*/var express =engine =IO =app =es =server = ;/*** Handle the upgrade*/server;/*** Configuration*/app;/*** Handle the connection*/es;/*** Bind to port*/server;console;
Head over to io for tests.
(The MIT License)
Copyright (c) 2012 Matthew Mueller <firstname.lastname@example.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.