Skip to content

Commit

Permalink
Support the close event; also minor bug fix ensuring server version o…
Browse files Browse the repository at this point in the history
…f root starts at 2, not 1; and version bump

--HG--
extra : signature : gnupg%3AiQEcBAABAgAGBQJPT72uAAoJEO%2BewIrBgcV3bi8H/1N9N0szP%2B1OnIW7%2B%2BCt9gRCqmP4ayOf7UMGBP/CsRPfSGF%2BF0xaDVj%2BUHXxCL01MbD3amW%2B9kHBwlxm16J4%2BjGdHWNSlZRbIUqVoKhKO9vyXdtusiJFUK4ylP1ZLDlTGhPvr0cgAgXMnwpdSmIDIUNZuDx7mVw1BPZkgnY2ZFERCi316z2073M0qxAfmBN/coHdW7NGDjx376HSMfGL2U221dF41mEgL29OWQGL%2BUlm3vIIKYlFb4cL2gVaE0v%2BDnFGmrcR0yRqdUbntKI7QBr4xkz3azT7dSwZa12tu4vxG0a0E04TQMMypcm1TekuKwNGRfi4zPtu%2BeeOGCZ81Vo%3D
  • Loading branch information
Matthew Sackman committed Mar 1, 2012
1 parent 05a0ae7 commit f37292a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/atomize-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
this.minTVarId = 0;

connection.on('data', this.data.bind(this));
connection.on('close', this.close.bind(this));
serverEventEmitter.emit('connection', this);
}

Expand All @@ -103,6 +104,10 @@
}
},

close: function () {
this.emit('close', this);
},

write: function (msg) {
this.connection.write(cereal.stringify(msg));
},
Expand Down Expand Up @@ -365,6 +370,7 @@
globalTVarCount = 1;
rootTVar = new TVar(globalTVarCount, Array.isArray(root), root);
globalTVars[rootTVar.id] = rootTVar;
rootTVar.bump(); // Need 2 bumps to ensure we're ahead of any clients.
rootTVar.bump();

emitter.client = function () { return new atomize.Atomize(Client, emitter); };
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "atomize-server",
"author": "Matthew Sackman",
"version": "0.0.4",
"version": "0.0.5",
"repository": {
"type": "git",
"url": "git://github.com/atomizejs/atomize-server-node.git"
Expand Down

0 comments on commit f37292a

Please sign in to comment.