Compare commits

...

10 Commits

Author SHA1 Message Date
Guillermo Rauch
7ca0606670 Release 0.6.17 2011-03-30 11:45:06 -07:00
Guillermo Rauch
f6036007fc Merge branch 'master' of github.com:LearnBoost/Socket.IO-node 2011-03-30 11:43:23 -07:00
Guillermo Rauch
aa027ab571 Preparing awesome 0.7 changelog 2011-03-07 10:16:51 -08:00
Guillermo Rauch
b4f24c6995 Added reconnect events to chat example 2011-03-07 10:11:24 -08:00
Guillermo Rauch
3a53c63778 Added Arnout as official contributor 2011-03-07 09:46:12 -08:00
Arnout Kazemier
d8e3ccc637 Cleaned up the code, changed tabs to spaces and incorporated feedback on from the pull request 2011-03-06 15:25:35 +01:00
Arnout Kazemier
cef5fb3574 Merge branch 'master' of git://github.com/LearnBoost/Socket.IO-node 2011-03-05 19:36:42 +01:00
Arnout Kazemier
648b1d0792 Passes test-cases again, without hanging the test suite.
The fix for it is not as elegant as I would have hoped but it does the
job, preventing un-needed listeners to be added on the connections.
2011-03-03 21:39:27 +01:00
Arnout Kazemier
63624e5996 Added more listeners, to prevent uncaught exceptions. See https://gist.github.com/615009 for uncaptured 'timeout' errors. 2011-03-03 14:13:19 +01:00
Arnout Kazemier
1ee5285136 Fixed the 'possible EventEmitter memory leak detected' bug for the XHR transport. 2011-03-03 13:36:06 +01:00
5 changed files with 62 additions and 33 deletions

View File

@@ -1,4 +1,10 @@
0.6.17 / 2011-03-30
==================
* Fixed the 'possible EventEmitter memory leak detected' bug for the XHR transport
* Reconnection support added to chat example. [3rd-Eden]
0.6.16 / 2011-03-04
===================

View File

@@ -13,6 +13,8 @@
var el = document.createElement('p');
if ('announcement' in obj) el.innerHTML = '<em>' + esc(obj.announcement) + '</em>';
else if ('message' in obj) el.innerHTML = '<b>' + esc(obj.message[0]) + ':</b> ' + esc(obj.message[1]);
if( obj.message && window.console && console.log ) console.log(obj.message[0], obj.message[1]);
document.getElementById('chat').appendChild(el);
document.getElementById('chat').scrollTop = 1000000;
}
@@ -38,11 +40,17 @@
for (var i in obj.buffer) message(obj.buffer[i]);
} else message(obj);
});
socket.on('connect', function(){ message({ message: ['System', 'Connected']})});
socket.on('disconnect', function(){ message({ message: ['System', 'Disconnected']})});
socket.on('reconnect', function(){ message({ message: ['System', 'Reconnected to server']})});
socket.on('reconnecting', function( nextRetry ){ message({ message: ['System', 'Attempting to re-connect to the server, next attempt in ' + nextRetry + 'ms']})});
socket.on('reconnect_failed', function(){ message({ message: ['System', 'Reconnected to server FAILED.']})});
</script>
<h1>Sample chat client</h1>
<div id="chat"><p>Connecting...</p></div>
<form id="form" onsubmit="send(); return false">
<form id="form" onSubmit="send(); return false">
<input type="text" autocomplete="off" id="text"><input type="submit" value="Send">
</form>

View File

@@ -61,33 +61,44 @@ Client.prototype._onMessage = function(data){
};
Client.prototype._onConnect = function(req, res){
var self = this;
var self = this
, attachConnection = !this.connection;
this.request = req;
this.response = res;
this.connection = req.connection;
this.connection.addListener('end', function(){
self._onClose();
if (self.connection)
self.connection.destroy();
});
if(!attachConnection) attachConnection = !attachConnection && this.connection.eventsAttached === undefined;
this.connection.eventsAttached = true;
if (attachConnection){
function destroyConnection(){
self._onClose();
self.connection && self.connection.destroy()
};
this.connection.addListener('end', destroyConnection);
this.connection.addListener('timeout', destroyConnection);
this.connection.addListener('error', destroyConnection);
}
if (req){
req.addListener('error', function(err){
function destroyRequest(){
req.destroy && req.destroy();
});
if (res) res.addListener('error', function(err){
res.destroy && res.destroy();
});
req.connection.addListener('error', function(err){
req.connection.destroy && req.connection.destroy();
});
};
req.addListener('error', destroyRequest);
req.addListener('timeout', destroyRequest);
if (res){
function destroyResponse(){
res.destroy && res.destroy();
}
res.addListener('error', destroyResponse);
res.addListener('timeout', destroyResponse);
}
if (this._disconnectTimeout) clearTimeout(this._disconnectTimeout);
}
};
Client.prototype._payload = function(){
var payload = [];

View File

@@ -23,4 +23,4 @@ exports.Listener = require('./listener');
* Version
*/
exports.version = '0.6.16';
exports.version = '0.6.17';

View File

@@ -1,17 +1,21 @@
{ "name" : "socket.io"
, "description" : "The cross-browser WebSocket"
, "version" : "0.6.16"
, "author" : "LearnBoost"
, "licenses" :
[ { "type" : "MIT"
, "url" : "http://github.com/learnboost/Socket.IO-node/raw/master/README.md"
{
"name": "socket.io"
, "description": "The cross-browser WebSocket"
, "version": "0.6.17"
, "author": "Guillermo Rauch <guillermo@learnboost.com>"
, "contributors": [
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }
, { "name": "Arnout Kazemier", "email": "info@3rd-eden.com" }
]
, "licenses": [{
"type": "MIT"
, "url": "http://github.com/learnboost/Socket.IO-node/raw/master/README.md"
}]
, "repository": {
"type": "git"
, "url": "http://github.com/learnboost/Socket.IO-node.git"
}
]
, "repository" :
{ "type" : "git"
, "url" : "http://github.com/learnboost/Socket.IO-node.git"
}
, "engine" : [ "node >=0.1.102" ]
, "main" : "./index"
, "scripts" : { "test" : "make test" }
, "engine": [ "node >=0.1.102" ]
, "main": "./index"
, "scripts": { "test" : "make test" }
}