1.0.5 • Published 7 years ago

express-socket.io-router v1.0.5

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
7 years ago

express-socket.io-router

Express-like routing interface for Socket.IO

Build Status

Install

npm install --save express-socket.io-router

Usage

Server

const SocketIO = require('socket.io');
const ExpressSocketIO = require('express-socket.io-router');

var io = new SocketIO(8080);
ExpressSocketIO(io);

io.register('test:path', function(req, res, next){
    console.log('request:', req.query, req.socket);
    res.send({
        query: req.query
    });
    next();
});

Client

const SocketIOClient = require('socket.io-client');

client = SocketIOClient.connect('http://localhost:8080');
client.emit('test:path', { data: 'test' }, function(err, res){
    console.log('response:', res);
});
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago