Closed xTACTICSx closed 10 years ago
Try this. you don't need cluster unless you've a multi server setup.
Chat = new Meteor.Stream('chat');
if(Meteor.isClient) {
Chat.emit('join', 'meteor-talk-room');
sendMessage = function(message) {
Chat.emit('message', message, 'meteor-talk-room');
}
}
if(Meteor.isServer) {
var subscriptionGroup = {};
Chat.on('join', function(group) {
var subscriptionId = this.subscriptionId;
subscriptionGroup[subscriptionId] = group;
this.onDisconnect = function() {
delete subscriptionGroup[subscriptionId];
};
});
Chat.permission.write(function() {
true;
});
Chat.permission.read(function(event, message, group) {
var myGroup = subscriptionGroup[this.subscriptionId];
return event == 'message' && myGroup == group;
}, false);
}
Thank you so much! Works great(: I was able to get it working
Hey everyone,
I was wondering if this method would be even possible using streams but is it possible to add rooms? I have tried several different ways but I am having trouble getting it to work. Do I need to add clusters? Any help would be greatly appreciated!