Releases: fullstackers/socket.io-events
Code Clean-up
@smart--petea cleaned up code
Socket Wrapper Updates
Removed the hardcoded delegations from the Socket
class to the socket
instance.
Bug Fixes
The socket.io Socket instance's emit was being manipulated which prevented other events happening concurrently from being processed. The socket.io socket instance is now wrapped in a proxy object. The proxy object is manipulated now instead of the actual socket.io Socket instance.
Bug Fixes
There was an issue with event consumption. Events are now properly consumed when you call socket.emit(...)
.
Pattern Matching Events
Events can now be matched via RegExp
and wildcards.
var router = require('socket.io-events')();
router.on(/^\w+/, function (sock, args, next) {
// do something but don't consume it!
next();
});
router.on('*thing', function (sock, args, next) {
// do something but don't consume it!
next();
});
router.on('some*', function (sock, args, next) {
// do something but don't consume it!
next();
});
var io = require('socket.io')(3000);
io.use(router);
io.on('connection', function (sock) {
sock.on('something', function (data) {
sock.emit('something', data);
});
});
Bug Fixes
There was an issue where an event would go back through the router stack under some circumstances.
Bug Fixes
Fixed an issue where their are no handlers in the router.
Bug Fixes
Routers were not playing nice when next to each other.
var io = require('socket.io')(3000):
io.use(Router());
io.use(Router());
The second Router
instance was overrode the socket.onevent
method when in fact it should have just attached it self to the previous router.
Stackable Router instances
Router instances are now stackable
var Router = require('socket.io-events');
var a = Router();
var b = Router();
a.use(b);
var io = require('socket.io')(3000);
io.use(a);