Skip to content

Commit 468db98

Browse files
committed
added precaution entries on connection state handler.
1 parent 6c08988 commit 468db98

File tree

23 files changed

+282
-1509
lines changed

23 files changed

+282
-1509
lines changed

core/pubnub-common.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ function PN_API(setup) {
443443
} );
444444

445445
// Reset Connection if Count Less
446-
if (each_channel() < 2) CONNECT();
446+
//if (each_channel() < 2)
447+
CONNECT();
447448
},
448449

449450
/*
@@ -569,14 +570,18 @@ function PN_API(setup) {
569570
SUB_RECEIVER = xdr({
570571
timeout : sub_timeout,
571572
callback : jsonp,
572-
fail : function() { SELF['time'](_test_connection) },
573+
fail : function() {
574+
SUB_RECEIVER = null;
575+
SELF['time'](_test_connection);
576+
},
573577
data : { 'uuid' : UUID, 'auth' : AUTH_KEY },
574578
url : [
575579
SUB_ORIGIN, 'subscribe',
576580
SUBSCRIBE_KEY, encode(channels),
577581
jsonp, TIMETOKEN
578582
],
579583
success : function(messages) {
584+
SUB_RECEIVER = null;
580585
if (!messages) return timeout( CONNECT, windowing );
581586

582587
// Restore Previous Connection Point if Needed
@@ -679,6 +684,7 @@ function PN_API(setup) {
679684
'each' : each,
680685
'each-channel' : each_channel,
681686
'grep' : grep,
687+
'offline' : _reset_offline,
682688
'supplant' : supplant,
683689
'now' : rnow,
684690
'unique' : unique,

modern/pubnub.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ function PN_API(setup) {
444444
} );
445445

446446
// Reset Connection if Count Less
447-
if (each_channel() < 2) CONNECT();
447+
//if (each_channel() < 2)
448+
CONNECT();
448449
},
449450

450451
/*
@@ -570,14 +571,18 @@ function PN_API(setup) {
570571
SUB_RECEIVER = xdr({
571572
timeout : sub_timeout,
572573
callback : jsonp,
573-
fail : function() { SELF['time'](_test_connection) },
574+
fail : function() {
575+
SUB_RECEIVER = null;
576+
SELF['time'](_test_connection);
577+
},
574578
data : { 'uuid' : UUID, 'auth' : AUTH_KEY },
575579
url : [
576580
SUB_ORIGIN, 'subscribe',
577581
SUBSCRIBE_KEY, encode(channels),
578582
jsonp, TIMETOKEN
579583
],
580584
success : function(messages) {
585+
SUB_RECEIVER = null;
581586
if (!messages) return timeout( CONNECT, windowing );
582587

583588
// Restore Previous Connection Point if Needed
@@ -680,6 +685,7 @@ function PN_API(setup) {
680685
'each' : each,
681686
'each-channel' : each_channel,
682687
'grep' : grep,
688+
'offline' : _reset_offline,
683689
'supplant' : supplant,
684690
'now' : rnow,
685691
'unique' : unique,

modern/pubnub.min.js

+19-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node.js/pubnub.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ function PN_API(setup) {
444444
} );
445445

446446
// Reset Connection if Count Less
447-
if (each_channel() < 2) CONNECT();
447+
//if (each_channel() < 2)
448+
CONNECT();
448449
},
449450

450451
/*
@@ -570,14 +571,18 @@ function PN_API(setup) {
570571
SUB_RECEIVER = xdr({
571572
timeout : sub_timeout,
572573
callback : jsonp,
573-
fail : function() { SELF['time'](_test_connection) },
574+
fail : function() {
575+
SUB_RECEIVER = null;
576+
SELF['time'](_test_connection);
577+
},
574578
data : { 'uuid' : UUID, 'auth' : AUTH_KEY },
575579
url : [
576580
SUB_ORIGIN, 'subscribe',
577581
SUBSCRIBE_KEY, encode(channels),
578582
jsonp, TIMETOKEN
579583
],
580584
success : function(messages) {
585+
SUB_RECEIVER = null;
581586
if (!messages) return timeout( CONNECT, windowing );
582587

583588
// Restore Previous Connection Point if Needed
@@ -680,6 +685,7 @@ function PN_API(setup) {
680685
'each' : each,
681686
'each-channel' : each_channel,
682687
'grep' : grep,
688+
'offline' : _reset_offline,
683689
'supplant' : supplant,
684690
'now' : rnow,
685691
'unique' : unique,

phonegap/pubnub.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ function PN_API(setup) {
444444
} );
445445

446446
// Reset Connection if Count Less
447-
if (each_channel() < 2) CONNECT();
447+
//if (each_channel() < 2)
448+
CONNECT();
448449
},
449450

450451
/*
@@ -570,14 +571,18 @@ function PN_API(setup) {
570571
SUB_RECEIVER = xdr({
571572
timeout : sub_timeout,
572573
callback : jsonp,
573-
fail : function() { SELF['time'](_test_connection) },
574+
fail : function() {
575+
SUB_RECEIVER = null;
576+
SELF['time'](_test_connection);
577+
},
574578
data : { 'uuid' : UUID, 'auth' : AUTH_KEY },
575579
url : [
576580
SUB_ORIGIN, 'subscribe',
577581
SUBSCRIBE_KEY, encode(channels),
578582
jsonp, TIMETOKEN
579583
],
580584
success : function(messages) {
585+
SUB_RECEIVER = null;
581586
if (!messages) return timeout( CONNECT, windowing );
582587

583588
// Restore Previous Connection Point if Needed
@@ -680,6 +685,7 @@ function PN_API(setup) {
680685
'each' : each,
681686
'each-channel' : each_channel,
682687
'grep' : grep,
688+
'offline' : _reset_offline,
683689
'supplant' : supplant,
684690
'now' : rnow,
685691
'unique' : unique,

0 commit comments

Comments
 (0)