connect method

void connect()

Implementation

void connect() {
  logger.debug('connect()');

  if (isConnected()) {
    logger.debug('Transport is already connected');

    return;
  } else if (isConnecting()) {
    logger.debug('Transport is connecting');

    return;
  }

  _close_requested = false;
  status = C.STATUS_CONNECTING;
  onconnecting(socket, _recover_attempts);

  if (!_close_requested) {
    // Bind socket event callbacks.
    socket!.onconnect = _onConnect;
    socket!.ondisconnect = _onDisconnect;
    socket!.ondata = _onData;
    socket!.connect();
  }
  return;
}