Skip to content
Browse files

Merge branch 'master' of https://github.com/sazze/node-websocket-server

… into sazze-master
  • Loading branch information...
2 parents d07e0f1 + 72ad210 commit d2ab6fb00bac087ce8496cf3e67a142aa440eb43 @miksago committed
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/ws/connection.js
View
9 lib/ws/connection.js
@@ -96,6 +96,11 @@ function Connection(manager, options, req, socket, upgradeHead) {
debug(connection.id, 'recv: ' + message);
connection.emit('message', message);
});
+
+ parser.on("close", function() {
+ debug(connection.id, "requested close");
+ connection.close();
+ });
socket.on('data', function(data) {
parser.write(data);
@@ -419,6 +424,10 @@ Parser.prototype.write = function(data) {
} else if (this.order == 1) {
debug('High Order packet handling is not yet implemented.');
this.order = 0;
+
+ if(data[i] === 0x00){
+ this.emit("close");
+ }
}
}
};

0 comments on commit d2ab6fb

Please sign in to comment.
Something went wrong with that request. Please try again.