code: function reconnectToNewUri(maxRetries, numRetries, reconnectWsUri) {
          Logger.debug("Reconnection attempt #" + numRetries);
  
          ws.close();
  
          wsUri = reconnectWsUri || wsUri;
  
          var newWs;
          if (useSockJS) {
              newWs = new SockJS(wsUri);
          } else {
              newWs = new WebSocket(wsUri);
          }
  
          newWs.onopen = function() {
              Logger.debug("Reconnected after " + numRetries + " attempts...");
              logConnected(newWs, wsUri);
              reconnecting = false;
              registerMessageHandler();
              if (config.onreconnected()) {
                  config.onreconnected();
              }
  
              newWs.onclose = reconnectionOnClose;
          };
  
          var onErrorOrClose = function(error) {
              Logger.warn("Reconnection error: ", error);
  
              if (numRetries === maxRetries) {
                  if (config.ondisconnect) {
                      config.ondisconnect();
                  }
              } else {
                  setTimeout(function() {
                      reconnectToSameUri(maxRetries, numRetries + 1);
                  }, RETRY_TIME_MS);
              }
          };
  
          newWs.onerror = onErrorOrClose;
  
          ws = newWs;
      }
docs: TODO Test retries. How to force not connection?