Jack-Stack Plugin for auto-loading socket.io files
npm install jack-socket-ioThis Jack-Stack Plugin that auto-loads your socket-io connections.
``js`
jack.add(require('jack-socket-io').configure({
dirnames: [ 'path1', 'path2', ]
}));
By default, the sockets event gets handled before jack-stack stack-end.config.useBefore
If you would like to move this elsewhere, you may set a config.useAfter
or the string eventname that you want to neighbor.
`js`
jack.add(require('jack-socket-io').configure({
dirnames: [],
useBefore: 'router',
}))
This plugin by default uses debug
for logging. If you would like to use your own logger, simply replace the
config.logger with one that you prefer. The format socket.io is expecting
is:
`js`
require('olympus-sockets')({
dirnames: [],
logger: {
sockets: {
debug: someLoggingFunction,
info: someLoggingFunction,
error: someLoggingFunction,
warn: someLoggingFunction,
}
}
});
`js``
module.exports = function(io) {
var room = io.of('something');
room.on('connection', ...
...
}
[npm-image]: https://img.shields.io/npm/v/jack-socket-io.svg
[npm-url]: https://www.npmjs.org/package/jack-socket-io
[downloads-image]: https://img.shields.io/npm/dm/jack-socket-io.svg
[downloads-url]: https://www.npmjs.org/package/jack-socket-io