I\'m having some problems with socket.io, and I have no idea how to solve it. I\'ve an app with a login system with socket.io to manage user interactions. Also I\'ve an arra
Intercom library can be used to share and manage a socket.io connection.
// Initialize socket.io on one tab
var socket = io.connect('//yourwebsite.com/socketio');
// Initialize intercom on all tab
var intercom = Intercom.getInstance();
intercom.bind(socket);
// Listen to an event
intercom.on('msgBroadcast', function(data){
console.log(data);
});
// Emit an event
intercom.emit('msgBroadcast', {
socket: true,
message: 'Hello all!'
});
You could also use socketio shared webworkers