Closed tommedema closed 13 years ago
Hi tom,
Do you mean on the server?
The connected event should already be passing in the full now and user object, not just the clientId.
Eric
@ericz,
Indeed I am talking about the server side.
What you are saying is different from the documentation, I quote:
.on
Every group receives two events connect and disconnect. Connect is triggered when a user is added to the group. Disconnect is triggered when a user is removed from the group. These event handlers are called with one parameter, the this.user.clientId of the user that has connected or disconnected. Additionally you can also access that users this.now object (and also this.user.clientId).
everyone.on('connect', function(clientId){ //this.now.setup(); });
everyone.on('disconnect', function(clientId){ //this.now.destruct(); });
Hi tom,
I believe this issue is caused by outdated documentation
@ericz, alright.
On a related note, it would help if the documentation was maintained on github so that we can create pull requests for it.
Also, I wanted to ask, since you use an internal versioning system, is there any point in making pull requests or are we building on outdated code?
@tommedema: Documentation is available here https://github.com/Flotype/now/tree/master/doc/public . Everything on github is the latest working code we have internally. Think of it like a "nightly" release. So pull requests on the docs or the code itself are much appreciated.
@tommedema
Definitely make pull requests! Everything in github (including the docs) are masters, and the latest code we have.
The connected event returns the clientId string of a client. I am not sure why you've decided to do this, but it'd make much more sense to make it return the actual client rather than it's id. Especially since there is no way to efficiently get a client reference from a client id.
If one still wants the id, he could just use client.user.clientId.
This way, clients can be stored for future use and the developer can implement his own selection mechanics etc.