Relay constructor

Relay(
  1. String url, {
  2. WriteAccess access = WriteAccess.readOnly,
  3. dynamic onError(
    1. String
    )?,
  4. RelayInfoProvider? relayInfoProvider,
})

Creates a Relay object.

url is the URL of the relay. access specifies read/write access for the added relay and may be set to either WriteAccess.readOnly, WriteAccess.writeOnly, or WriteAccess.readWrite. If not provided the default is read-only. relayInfoProvider is used for testing and not intended for normal use.

Implementation

Relay(this.url,
    {this.access = WriteAccess.readOnly,
    this.onError,
    RelayInfoProvider? relayInfoProvider})
    : _relayInfoProvider =
          relayInfoProvider ?? RelayInfoProvider(http: http.Client()) {
  _ws = WebSocketHandler(url);
  _ws.addListener(_onData);
}