withUrl method

HubConnectionBuilder withUrl(
  1. String url, {
  2. HttpConnectionOptions? options,
  3. HttpTransportType? transportType,
})

Configures the {@link @microsoft/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL.

url: The URL the connection will use. options: An options object used to configure the connection. transportType: The requested (and supported) transportedType. Use either options or transportType. Returns the builder instance, for chaining.

Implementation

HubConnectionBuilder withUrl(String url,
    {HttpConnectionOptions? options, HttpTransportType? transportType}) {
  assert(!isStringEmpty(url));
  assert(!(options != null && transportType != null));

  _url = url;

  if (options != null) {
    _httpConnectionOptions = options;
  } else {
    _httpConnectionOptions = HttpConnectionOptions(transport: transportType);
  }

  return this;
}