File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1055,6 +1055,7 @@ function onMessageArrived(message) {
10551055 this . connected = false ;
10561056
10571057
1058+ this . _trace ( "_doConnect " , wsurl ) ;
10581059
10591060 if ( this . connectOptions . mqttVersion < 4 ) {
10601061 this . socket = new global . WebSocket ( wsurl , [ "mqttv3.1" ] ) ;
@@ -1542,8 +1543,12 @@ function onMessageArrived(message) {
15421543 if ( this . _reconnectInterval < 128 )
15431544 this . _reconnectInterval = this . _reconnectInterval * 2 ;
15441545 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 ] ) ;
15471552 } else {
15481553 this . _doConnect ( this . uri ) ;
15491554 }
You can’t perform that action at this time.
0 commit comments