Comparing version 0.3.0 to 0.3.1
@@ -0,2 +1,5 @@ | ||
0.3.1 - 2013-04-06 | ||
- added a failed message to the connect callback if version negotiation fails. | ||
0.3.0 - 2013-03-18 | ||
- moved over to DDP-pre1 |
@@ -11,4 +11,9 @@ var DDPClient = require("../lib/ddp-client"); | ||
ddpclient.connect(function() { | ||
ddpclient.connect(function(error) { | ||
console.log('connected!'); | ||
if (error) { | ||
console.log('DDP connection error!'); | ||
return; | ||
} | ||
@@ -15,0 +20,0 @@ ddpclient.call('test-function', ['foo', 'bar'], function(err, result) { |
@@ -61,3 +61,3 @@ var WebSocket = require('ws'), | ||
self.emit('socket-close', code, message); | ||
if (self.auto_reconnect) { | ||
if (self.auto_reconnect && ! self._connectionFailed) { | ||
setTimeout(function() { self.connect(); }, self.auto_reconnect_timer); | ||
@@ -95,3 +95,6 @@ } | ||
return; | ||
} else if (data.msg === 'failed') { | ||
self.emit('failed', data); | ||
} else if (data.msg === 'connected') { | ||
@@ -198,6 +201,12 @@ self.session = data.session; | ||
var self = this; | ||
self._connectionFailed = false; | ||
if (connected) | ||
if (connected) { | ||
self.addListener("connected", connected); | ||
self.addListener("failed", function(error) { | ||
self._connectionFailed = true; | ||
connected(error) | ||
}); | ||
} | ||
// websocket | ||
@@ -204,0 +213,0 @@ var protocol = self.use_ssl ? 'wss://' : 'ws://'; |
{ | ||
"name": "ddp", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Node.js module to connect to servers using DDP protocol.", | ||
@@ -5,0 +5,0 @@ "author": "Tom Coleman <tom@thesnail.org> (http://tom.thesnail.org), Mike Bannister <notimpossiblemike@gmail.com> (http://po.ssibiliti.es)", |
Sorry, the diff of this file is not supported yet
10348
233
93