Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change connect/disconnect events to occur on nowjs instead of everyone

  • Loading branch information...
commit 275067a1c93c51b51fcca316ba5b5e9c8c51315f 1 parent c9aae9b
Eric Zhang ericz authored
8 examples/express_example/app.js
View
@@ -28,16 +28,16 @@ console.log("Express server listening on port %d", app.address().port);
// NowJS component
+var nowjs = require("now");
+var everyone = nowjs.initialize(app);
-var everyone = require("now").initialize(app);
-
-everyone.connected(function(){
+nowjs.on('connect', function(){
console.log("Joined: " + this.now.name);
});
-everyone.disconnected(function(){
+nowjs.on('disconnect', function(){
console.log("Left: " + this.now.name);
});
4 examples/multiroomchat_example/multiroomchat_server.js
View
@@ -13,14 +13,14 @@ var nowjs = require("now");
var everyone = nowjs.initialize(server);
-everyone.on('connect', function(){
+nowjs.on('connect', function(){
this.now.room = "room 1";
nowjs.getGroup(this.now.room).addUser(this.user.clientId);
console.log("Joined: " + this.now.name);
});
-everyone.on('disconnect', function(){
+nowjs.on('disconnect', function(){
console.log("Left: " + this.now.name);
});
Please sign in to comment.
Something went wrong with that request. Please try again.