diff --git a/packages/livedata/livedata_connection.js b/packages/livedata/livedata_connection.js index 5502857651..293e09a82c 100644 --- a/packages/livedata/livedata_connection.js +++ b/packages/livedata/livedata_connection.js @@ -216,8 +216,8 @@ var Connection = function (url, options) { if (msg.msg === 'connected') { self._version = self._versionSuggestion; - options.onConnected(); self._livedata_connected(msg); + options.onConnected(); } else if (msg.msg == 'failed') { if (_.contains(self._supportedDDPVersions, msg.version)) { @@ -310,7 +310,7 @@ var Connection = function (url, options) { var onDisconnect = function () { if (self._heartbeat) { - self._heartbeat.stop() + self._heartbeat.stop(); self._heartbeat = null; } }; @@ -543,7 +543,7 @@ _.extend(Connection.prototype, { stop: function () { if (!_.has(self._subscriptions, id)) return; - + self._subscriptions[id].stop(); }, ready: function () { @@ -987,7 +987,7 @@ _.extend(Connection.prototype, { heartbeatInterval: self._heartbeatInterval, heartbeatTimeout: self._heartbeatTimeout, onTimeout: function () { - if (Meteor.isClient) { + if (Meteor.isClient && ! self._stream._isStub) { // only print on the client. this message is useful on the // browser console to see that we've lost connection. on the // server (eg when doing server-to-server DDP), it gets diff --git a/packages/livedata/livedata_connection_tests.js b/packages/livedata/livedata_connection_tests.js index 334cd59a3b..5e043d8ea3 100644 --- a/packages/livedata/livedata_connection_tests.js +++ b/packages/livedata/livedata_connection_tests.js @@ -169,7 +169,7 @@ Tinytest.add("livedata stub - reactive subscribe", function (test) { completerHandle = conn.subscribe("completer", onReady("completer")); stopperHandle = conn.subscribe("stopper", onReady("stopper")); }); - + var completerReady; var readyAutorunHandle = Deps.autorun(function() { completerReady = completerHandle.ready(); @@ -350,7 +350,7 @@ Tinytest.add("livedata stub - reactive subscribe handle correct", function (test Deps.flush(); test.isTrue(fooHandle.ready()); test.isTrue(fooReady); - + autorunHandle.stop(); }); diff --git a/packages/livedata/stub_stream.js b/packages/livedata/stub_stream.js index 54e75c8367..5901f276a1 100644 --- a/packages/livedata/stub_stream.js +++ b/packages/livedata/stub_stream.js @@ -52,7 +52,9 @@ _.extend(StubStream.prototype, { _.each(self.callbacks['reset'], function (cb) { cb(); }); - } - + }, + // Provide a tag to detect stub streams. + // We don't log heartbeat failures on stub streams, for example. + _isStub: true });