diff --git a/.gitmodules b/.gitmodules index a6bd65fe..72b8bb6e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = git://github.com/visionmedia/js-oo.git [submodule "test/client"] path = test/client - url = git@github.com:RosePad/Socket.IO-client.git + url = git@github.com:RosePad/Socket.IO.git diff --git a/lib/socket.io/client.js b/lib/socket.io/client.js index 9ec7a31a..3901ac0f 100644 --- a/lib/socket.io/client.js +++ b/lib/socket.io/client.js @@ -11,7 +11,6 @@ this.Client = Class({ send: function(message){ if (!this.connected || !(this.connection.readyState == 'open' || this.connection.readyState == 'writeOnly')) return this._queue(message); - sys.log('will deliver ' + message + ' to ' + this.sessionId); this._write(JSON.stringify({messages: [message]})); return this; }, @@ -62,7 +61,6 @@ this.Client = Class({ var self = this; this.connected = false; this._disconnectTimeout = setTimeout(function(){ - sys.log('timeout!'); self._onDisconnect(); }, this.listener.options.timeout); }, diff --git a/lib/socket.io/transports/server-events.js b/lib/socket.io/transports/server-events.js index 76deacaa..da22b716 100644 --- a/lib/socket.io/transports/server-events.js +++ b/lib/socket.io/transports/server-events.js @@ -39,7 +39,8 @@ this['server-events'] = Client.extend({ }, _write: function(message){ - this.response.write("Event: socket.io\ndata: " + message); + this.response.write("Event: socket.io"); + this.response.write("data: " + message); } }); \ No newline at end of file diff --git a/lib/socket.io/transports/websocket.js b/lib/socket.io/transports/websocket.js index 625bef2d..7f398b03 100644 --- a/lib/socket.io/transports/websocket.js +++ b/lib/socket.io/transports/websocket.js @@ -34,7 +34,7 @@ this.websocket = Client.extend({ }); }); - // this.response.use_chunked_encoding_by_default = false; + this.response.use_chunked_encoding_by_default = false; this.response.writeHeader(101, 'Web Socket Protocol Handshake', { 'Upgrade': 'WebSocket', 'Connection': 'Upgrade', diff --git a/lib/socket.io/transports/xhr-multipart.js b/lib/socket.io/transports/xhr-multipart.js index bce5300a..9e7b7081 100644 --- a/lib/socket.io/transports/xhr-multipart.js +++ b/lib/socket.io/transports/xhr-multipart.js @@ -7,7 +7,8 @@ this['xhr-multipart'] = Client.extend({ var self = this; switch (req.method){ case 'GET': - var self = this; + var self = this; + this.__super__(req, res); this.request.addListener('end', function(){ if (!('hijack' in self.connection)){ throw new Error('You have to patch Node! Please refer to the README'); @@ -16,13 +17,14 @@ this['xhr-multipart'] = Client.extend({ self.connection.addListener('end', function(){ self._onClose(); }); self.connection.hijack(); self.connection.setTimeout(0); - self.response.use_chunked_encoding_by_default = false; }); + this.response.use_chunked_encoding_by_default = false; this.response.writeHead(200, { - 'Content-type': 'multipart/x-mixed-replace;boundary=socketio' + 'Content-Type': 'multipart/x-mixed-replace;boundary=socketio', + 'Connection': 'keep-alive' }); - this.response.write("--socketio\r\n"); + this.response.write("--socketio\n"); this.response.flush(); this._payload(); @@ -43,9 +45,10 @@ this['xhr-multipart'] = Client.extend({ }, _write: function(message){ - this.response.write("Content-type: text/plain\r\n"); - this.response.write(message); - this.response.write("\r\n--socketio\r\n"); + this.response.write("Content-Type: text/plain\n\n"); + this.response.write(message + "\n"); + this.response.write("--socketio\n"); + this.response.flush(); } }); \ No newline at end of file diff --git a/test/chat.html b/test/chat.html index 081eb3de..65ead286 100644 --- a/test/chat.html +++ b/test/chat.html @@ -4,7 +4,6 @@