UHST constructor

UHST({
  1. String? relayUrl,
  2. bool? debug,
  3. UhstRelayClient? relayClient,
  4. RelaySocketProvider? socketProvider,
})

relayUrl is a relay url String, implementing the uhst protocol.

For server you can use ready to go UHST Node Server

relayClient is a standard host and client provider which used to subscribe to event source, send messages and init UhstHost and Client UhstSocket

If no relayClient is provided and relayUrl is not defined then a public relay will be chosen by the API.

If both relayClient and relayUrl are defined, then relayClient will be used.

Use debug = true to turn on debug messages on stream events

Implementation

UHST({
  String? relayUrl,
  bool? debug,
  UhstRelayClient? relayClient,
  RelaySocketProvider? socketProvider,
}) {
  _debug = debug ?? false;

  if (relayClient != null) {
    _relayClient = relayClient;
  } else if (relayUrl != null) {
    _relayClient = RelayClient(
      relayUrl: relayUrl,
    );
  } else {
    _relayClient = ApiClient();
  }
  _socketProvider = socketProvider ?? RelaySocketProvider();
}