initialize ({ userAgent, boltAgent, authToken, notificationFilter, onError, onComplete } = {}) {
    const state = {}
    const observer = new LoginObserver({
      onError: error => this._onLoginError(error, onError),
      onCompleted: metadata => {
        state.metadata = metadata
        return this._onLoginCompleted(metadata)
      }
    })

    this.write(
      // if useragent is null then for all versions before 5.3 it should be bolt agent by default
      RequestMessage.hello5x2(userAgent, notificationFilter, this._serversideRouting),
      observer,
      false
    )

    return this.logon({
      authToken,
      onComplete: metadata => onComplete({ ...metadata, ...state.metadata }),
      onError,
      flush: true
    })
  }
Initialize a connection with the server

@param {Object} args The params
@param {string} args.userAgent The user agent
@param {string} args.boltAgent The bolt agent
@param {any} args.authToken The auth token
@param {NotificationFilter} args.notificationFilter The notification filters.
@param {function(error)} args.onError On error callback
@param {function(onComplete)} args.onComplete On complete callback
@returns {LoginObserver} The Login observer