arunoda / meteor-streams

Realtime messaging for Meteor
http://arunoda.github.io/meteor-streams
MIT License
287 stars 97 forks source link

Additional parameters is null in read permissions #32

Open ignl opened 9 years ago

ignl commented 9 years ago

Hi,

I have following code for chat application with channels:

stream.permissions.write(function(eventName, message, channelName) {
    var currentUser = Meteor.users.findOne({_id : this.userId});
    return _.contains(currentUser.channelsJoined, channelName) // if user joined chat - allow him to send chat stream message
}, false);
}

stream.permissions.read(function(eventName, message, channelName) {
    var currentUser = Meteor.users.findOne({_id : this.userId});
    return _.contains(currentUser.channelsJoined, channelName) // if user joined chat - allow him to receive chat stream message
}, false);
}

When I pass channel name in emit - write permissions sees it, however in read permissions code channelName argument is undefined. I didn't find much about this in documentation and it seems it should work like that. What I am doing wrong? Or is it a bug? Because permissions without additional parameters is pretty much useless in real world scenarios...

ignl commented 9 years ago

Also channel argument is undefined on receiving message in client:

stream.on('chat', function(message, channel) {
ignl commented 9 years ago

Is this project dead?

matteodem commented 9 years ago

Yep.

ignl commented 9 years ago

Ok I see, thanks, I guess I need an alternative...