Permalink
Browse files

More support for disconnections

  • Loading branch information...
1 parent b19bac2 commit ae9e550c26a883b3f4d264711639560dd747352e @rauchg rauchg committed Apr 30, 2010
@@ -36,8 +36,8 @@ this.Client = Class({
var self = this;
this.request = req;
this.response = res;
- this.connection = this.request.connection;
- if (this._disconnectTimeout) clearTimeout(this._disconnectTimeout);
+ this.connection = this.request.connection;
+ if (this._disconnectTimeout) clearTimeout(this._disconnectTimeout);
},
_payload: function(){
@@ -4,16 +4,15 @@ var Client = require('../client').Client,
this['htmlfile'] = Client.extend({
_onConnect: function(req, res){
+ var self = this, body = '';
switch (req.method){
case 'GET':
- var self = this;
this.__super__(req, res);
-
+ this.request.connection.addListener('end', function(){ self._onClose(); });
this.response.useChunkedEncodingByDefault = false;
this.response.shouldKeepAlive = true;
this.response.writeHead(200, { 'Content-type': 'text/html' });
this.response.flush();
-
this._payload();
break;
@@ -9,7 +9,7 @@ this['xhr-multipart'] = Client.extend({
case 'GET':
var self = this;
this.__super__(req, res);
-
+ this.request.connection.addListener('end', function(){ self._onClose(); });
this.response.useChunkedEncodingByDefault = false;
this.response.shouldKeepAlive = true;
this.response.writeHead(200, {
@@ -18,7 +18,6 @@ this['xhr-multipart'] = Client.extend({
});
this.response.write("--socketio\n");
this.response.flush();
-
this._payload();
break;
@@ -9,7 +9,7 @@ this['xhr-polling'] = Client.extend({
},
_onConnect: function(req, res){
- var self = this;
+ var self = this, body = '';
switch (req.method){
case 'GET':
this.__super__(req, res);

0 comments on commit ae9e550

Please sign in to comment.