Skip to content

Commit dbd2e68

Browse files
committed
No longer bother removing the callbacks, app should quit.
1 parent d0ac399 commit dbd2e68

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

README.markdown

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ var ddpclient = new DDPClient({
3030
auto_reconnect_timer: 500
3131
});
3232

33-
ddpclient.connect(function() {
33+
ddpclient.connect(function(error) {
34+
if (error) {
35+
console.log('DDP connection error!');
36+
return;
37+
}
38+
3439
console.log('connected!');
3540

3641
ddpclient.call('test-function', ['foo', 'bar'], function(err, result) {
@@ -77,8 +82,11 @@ Unimplemented Features
7782
Thanks
7883
======
7984

80-
Many thanks to Alan Sikora, and also Mike Bannister(@possibilities) for the initial ddp client.
85+
Many thanks to Alan Sikora for the ddp-client which formed the inspiration for this code.
8186

8287
Contributions:
88+
* Tom Coleman (@tmeasday)
89+
* Thomas Sarlandie (@sarfata)
90+
* Mason Gravitt (@emgee3)
91+
* Mike Bannister (@possiblities)
8392
* Chris Mather (@eventedmind)
84-
* Thomas Sarlandie (@sarfata)

lib/ddp-client.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,10 @@ DDPClient.prototype.connect = function(connected) {
200200

201201
if (connected) {
202202
self.addListener("connected", connected);
203-
204-
var failed = function(error) {
203+
self.addListener("failed", function(error) {
205204
self._connectionFailed = true;
206-
207-
// remove the event listeners
208-
self.removeListener("connected", connected)
209-
self.removeListener("failed", failed);
210-
211-
connected(error);
212-
};
213-
self.addListener("failed", failed);
205+
connected(error)
206+
});
214207
}
215208

216209
// websocket

0 commit comments

Comments
 (0)