The best package I've found is Streamy. It allows you to send to all or only one specific user.
https://github.com/YuukanOO/streamy
meteor add yuukan:streamy
Send a message to everyone:
Streamy.broadcast('ddpEvent', { data: 'something happened for all' });
Listen to the message on the client:
// Attach an handler for a specific message Streamy.on('ddpEvent', function(d, s) { console.log(d.data); });
Send a message to one user (by id)
var socket = Streamy.socketsForUsers(["nJyQvECmkBSXDZEN2"])._sockets[0] Streamy.emit('ddpEvent', { data: 'something happened for you' }, socket);
user3413723
source share