Skip to content

Instantly share code, notes, and snippets.

@gitawego
Forked from pauldenotter/plugin.js
Last active August 29, 2015 14:10
Show Gist options
  • Save gitawego/2cc4b4a56552b5051bcd to your computer and use it in GitHub Desktop.
Save gitawego/2cc4b4a56552b5051bcd to your computer and use it in GitHub Desktop.
var socketIO = require('socket.io'),
io;
// hapi plugin registration
exports.register = function(plugin, options, next) {
// this is the hapi specific binding
io = socketIO.listen(plugin.servers[0].listener);
io.sockets.on('connection', function(socket) {
socket.emit({msg: 'welcome'});
});
next();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment