Closed aashay closed 13 years ago
That is indeed a better behavior but the problem is the group doesn't know about the existence of the receivedMessage
method unless a user that has it is added to the group.
So unfortunately it's not possible to make it work that way because we would have to know all possible method names the user would possibly want to call and have filler noop methods that have those names. It isn't possible to know what method names to do that for without any users added to the group.
I guess that makes sense. Once isINGroup is implemented, this kind of situation will probably be much more manageable. Thanks Eric!
On Apr 26, 2011, at 9:55 AM, ericzreply@reply.github.com wrote:
That is indeed a better behavior but the problem is the group doesn't know about the existence of the
receivedMessage
method unless a user that has it is added to the group.So unfortunately it's not possible to make it work that way because we would have to know all possible method names the user would possibly want to call and have filler noop methods that have those names. It isn't possible to know what method names to do that for without any users added to the group.
Reply to this email directly or view it on GitHub: https://github.com/Flotype/now/issues/66#comment_1059307
I'll try to add that feature soon, it should be very easy to implement.
Eric
On Tue, Apr 26, 2011 at 9:58 AM, AashayDesai < reply@reply.github.com>wrote:
I guess that makes sense. Once isINGroup is implemented, this kind of situation will probably be much more manageable. Thanks Eric!
On Apr 26, 2011, at 9:55 AM, ericzreply@reply.github.com wrote:
That is indeed a better behavior but the problem is the group doesn't know about the existence of the
receivedMessage
method unless a user that has it is added to the group.So unfortunately it's not possible to make it work that way because we would have to know all possible method names the user would possibly want to call and have filler noop methods that have those names. It isn't possible to know what method names to do that for without any users added to the group.
Reply to this email directly or view it on GitHub: https://github.com/Flotype/now/issues/66#comment_1059307
Reply to this email directly or view it on GitHub: https://github.com/Flotype/now/issues/66#comment_1059328
510-691-3951 EECS Student at UC Berkeley http://ericzhang.com
@AashayDesai
Hi Aashay, I've added a hasClient function to groups. So you can do everyone.hasClient(clientId) or somegroup.hasClient(clientId)
The parameter is the this.user.clientId of the user, and it returns a boolean.
My hero! I'll take a look at it this weekend. Hopefully I can learn a thing or two and start contributing.
Thanks!
On Apr 27, 2011, at 10:26 PM, ericzreply@reply.github.com wrote:
@AashayDesai
Hi Aashay, I've added a hasClient function to groups. So you can do everyone.hasClient(clientId) or somegroup.hasClient(clientId)
The parameter is the this.user.clientId of the user, and it returns a boolean.
Reply to this email directly or view it on GitHub: https://github.com/Flotype/now/issues/66#comment_1068289
tl;dr: Calling funcs in the now-space of an empty group should do nothing.
Do this: everyone.now.sendToChannel = function(message, channel){ //send a particular message to every member of a channel
var group = nowjs.getGroup(channel);
group.now.receiveMessage(message); }
If you don't actually do group.addUser(clientId) first, you have an empty group. You'll see the following error:
{ message: [Getter/Setter] , stack: [Getter/Setter] , type: 'undefined_method' , arguments: [ 'receiveMessage', {} ] } TypeError: Object # has no method 'receiveMessage'
at Object. (/.../myserver.js:126:15)
at Object.remoteCall (/usr/local/lib/node/.npm/now/0.5.1/package/lib/nowServerLib.js:49:19)
at [object Object]. (/usr/local/lib/node/.npm/now/0.5.1/package/lib/nowServerLib.js:173:46)
at [object Object].emit (events:27:15)
at [object Object]._onMessage (/usr/local/lib/node/.npm/socket.io/0.6.16/package/lib/socket.io/client.js:58:10)
at Parser. (native)
at Parser.emit (events:27:15)
at Parser.parse (/usr/local/lib/node/.npm/socket.io/0.6.16/package/lib/socket.io/transports/websocket.js:195:12)
While this error makes sense (since you're attempting to call receiveMessage on nothing), I don't think we need to see this. It's tricky to do my own error checking until "isINGroup" exists, so maybe it'd be better if nothing happened when there are no clients in the group?