Relay constructor
Relay(
- String url, {
- WriteAccess access = WriteAccess.readOnly,
- dynamic onError()?,
- 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);
}