-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making use of Meteor Streams as Message Threads #13
Comments
How about this solution. stream = new Meteor.Stream('private');
if(Meteor.isClient) {
stream.on(Meteor.userId(), function(message) {
alert('new message:', message);
});
sendMessage = function(message, to) {
//to is an array of userIds (in your to field)
stream.emit('send', message, to);
}
}
if(Meteor.isServer) {
stream.permissions.write(function(eventName) {
return eventName == 'send';
});
stream.permissions.read(function(eventName) {
return this.userId == eventName;
});
stream.on('send', function(message, to) {
to.forEach(function(userId) {
stream.emit(to, message);
});
});
} |
Hi Arunoda, Thanks for the reply. I will try this out.. |
Hi Arunoda, Does the solution you provided has already a collection attached to it? or that is only reachable if the Receiving User is online? |
I simply use |
Hi Arunoda, Sorry for the confusion. What i meant is that are the messages already STORED inside a collection so that whenever a user has logged in he/she can already see the message that is intended for them? |
Okay. Now I got it. Meteor Streams does not handle the message persistence. You can use stream Is this answer your question? On Mon, Oct 21, 2013 at 4:39 PM, ggmacasaet [email protected]:
Arunoda Susiripala @arunoda http://twitter.com/arunoda |
👍 |
Having an issue integrating Meteor-Streams to the application i am creating. The design i am doing is much more similar to Streaming Private Page communication pattern. What will happen is that i have 2 text area with TO and the Message. In the TO field it is the recipient of the message and the MESSAGE field is the main message.
Issue: Meteor-Streams should only send the message to the designated recipient on the TO FIELD, NOT ALL USERS THAT IS ACTIVE. Is there a way on how will i approach this?
The text was updated successfully, but these errors were encountered: