build method

HubConnection build ()

Creates a HubConnection from the configuration options specified in this builder.

Returns the configured HubConnection.


HubConnection build() {
  // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one
  // provided to configureLogger
  final httpConnectionOptions =
      _httpConnectionOptions ?? HttpConnectionOptions();

  // Now create the connection
  if (isStringEmpty(_url)) {
    throw new GeneralError(
        "The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");
  final connection = HttpConnection(_url, options: httpConnectionOptions);
  return HubConnection(connection, _logger, _protocol ?? JsonHubProtocol());