Permalink
Browse files

Merge branch 'master' of github.com:Flotype/now

  • Loading branch information...
2 parents 055e5e1 + b84a65c commit 0dda0f5d7204160945a0afe6ed8e2ef452ed677a Sridatta Thatipamala committed Apr 14, 2011
Showing with 10 additions and 4 deletions.
  1. +6 −1 lib/clientGroup.js
  2. +4 −3 readme.md
View
@@ -7,7 +7,7 @@ exports.ClientGroup = function ClientGroup(allScopes, defaultScope, socket, grou
var nowScope = {};
var isSuperGroup = false;
-
+
function connected(func) {
this.on('connect', func);
@@ -71,6 +71,7 @@ exports.ClientGroup = function ClientGroup(allScopes, defaultScope, socket, grou
groupScopes[clientId] = allScopes[clientId];
nowUtil.mergeScopes(allScopes[clientId], defaultScope);
+ this.count++;
this.emit.apply({_events: this._events, now: groupScopes[clientId], user:{clientId: clientId}}, ['connect', clientId]);
} else {
@@ -81,6 +82,9 @@ exports.ClientGroup = function ClientGroup(allScopes, defaultScope, socket, grou
function removeUser(clientId){
if(groupScopes.hasOwnProperty(clientId)){
+
+ this.count--;
+
this.emit.apply({_events: this._events, now: groupScopes[clientId], user:{clientId: clientId}}, ['disconnect', clientId]);
delete groupScopes[clientId];
}
@@ -104,6 +108,7 @@ exports.ClientGroup = function ClientGroup(allScopes, defaultScope, socket, grou
};
+ this.count = 0;
this.now = proxy.wrap(store, nowScope);
this.connected = connected;
this.disconnected = disconnected;
View
@@ -1,6 +1,6 @@
Get NowJS
=========
-NowJS is a NodeJS module. The client javascript (now.js) is served by the NowJS server.
+NowJS is a Node.js module. The client javascript (now.js) is served by the NowJS server.
<a href="https://github.com/Flotype/now/">Go to Github</a> or
@@ -26,7 +26,8 @@ NowJS uses the excellent <a href="https://github.com/LearnBoost/Socket.IO-node">
var httpServer = require('http').createServer(function(req, response){ /* Serve your static files */ })
httpServer.listen(8080);
- var everyone = require("now").initialize(httpServer);
+ var nowjs = require("now");
+ var everyone = nowjs.initialize(httpServer);
everyone.now.msg = "Hello World!";
**2. On the client**
@@ -44,7 +45,7 @@ NowJS uses the excellent <a href="https://github.com/LearnBoost/Socket.IO-node">
FAQ
-------
-**Q: Can I pass in a callback or closure, for example, if the remote function is asynchronous??**
+**Q: Can I pass in a callback or closure, for example, if the remote function is asynchronous?**
A: Yes. This is 100% supported

0 comments on commit 0dda0f5

Please sign in to comment.