File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1055,6 +1055,7 @@ function onMessageArrived(message) {
1055
1055
this . connected = false ;
1056
1056
1057
1057
1058
+ this . _trace ( "_doConnect " , wsurl ) ;
1058
1059
1059
1060
if ( this . connectOptions . mqttVersion < 4 ) {
1060
1061
this . socket = new global . WebSocket ( wsurl , [ "mqttv3.1" ] ) ;
@@ -1542,8 +1543,12 @@ function onMessageArrived(message) {
1542
1543
if ( this . _reconnectInterval < 128 )
1543
1544
this . _reconnectInterval = this . _reconnectInterval * 2 ;
1544
1545
if ( this . connectOptions . uris ) {
1545
- this . hostIndex = 0 ;
1546
- this . _doConnect ( this . connectOptions . uris [ 0 ] ) ;
1546
+ // Loop through all host until we find an working one.
1547
+ this . hostIndex ++ ;
1548
+ if ( this . hostIndex >= this . connectOptions . uris . length ) {
1549
+ this . hostIndex = 0 ;
1550
+ }
1551
+ this . _doConnect ( this . connectOptions . uris [ this . hostIndex ] ) ;
1547
1552
} else {
1548
1553
this . _doConnect ( this . uri ) ;
1549
1554
}
You can’t perform that action at this time.
0 commit comments