wse_client library
The WSE client for Dart and Flutter, on the Rust client.
Classes
- WseAppLifecycle
- Pauses client grace after the app went to the background, and resumes it when the app comes back. It pauses for a reason of its own, so a pause of the application's stays. Dispose of it with the client.
- WseClient
- A connection to a WSE server, made again when it is lost.
- WseClientPlugin
- Flutter's plugin entry: on Android the package's Java part sets up the certificate verifier; elsewhere there is nothing to register.
- WseConfig
- Where the client connects and how; durations in milliseconds, zero for the default.
- WseDelivery
-
The recover-or-resync delivery: a topic that is not continuous (a cold
start, every reconnect, a break) holds its messages until the
application brought its state up to date (a resync item, then
resynced(round)); the checkpoint is what it committed it applied, and recovery starts from it. - WseItem
- One thing the client heard; the fields its kind has are set.
- WseNetworkMonitor
- Pauses client while the device has no usable network, and makes its connection again when the network moves to other interfaces (Wi-Fi to mobile, say): the old connection may hang on an interface that is gone. Changes within settle of each other count once. It pauses for a reason of its own, so a pause of the application's stays. A LAN server needs no Internet: any usable network counts. The app feeds it what it sees, with connectivity_plus for one:
- WseStreamPosition
- Where a stream of a topic stands.
- WseTopicRecovery
- What a subscription replayed of a topic asked for with a position.
- WseTopicState
- WseTrust
- Which certificates a wss:// server's chain must lead to.
Enums
- WseContinuity
- Whether a topic's messages run without a break.
- WseItemKind
-
The kinds of
`WseItem`. - WseSubscription
- Whether the server took a topic.
Functions
-
generateSigningKey(
) → Uint8List - A new ECDSA P-256 private key (PKCS#8 DER) for signed messages: keep it in the platform's keystore.
-
signingPublicKey(
{required List< int> key}) → String - The public key of a PKCS#8 private key (base64 of the uncompressed point): what the server binds to a connection for its signed messages.
-
wseConfig(
String url, {String? token, List< String> topics = const [], bool msgpack = false, Map<String, String> headers = const {}, bool reconnect = true, Duration reconnectDelay = Duration.zero, Duration reconnectMaxDelay = Duration.zero, double reconnectFactor = 0, bool reconnectJitter = true, int reconnectMaxAttempts = 0, WseTrust trust = WseTrust.platform, bool insecure = false, WseDelivery? delivery, WseOffline? offline, List<String> serverIdentityKeys = const [], Uint8List? signingKey, List<String> serverSigningKeys = const []}) → WseConfig - A configuration with the defaults for what is not given.
-
wseDelivery(
String consumer, {String? schema, String? realm, String? checkpoint, int maxHeld = 0}) → WseDelivery -
The recover-or-resync delivery: a topic that is not continuous (a cold
start, every reconnect, a break) holds its messages until the application
brought its state up to date (a resync item, then WseClient.resynced);
consumeris the one that commits, by a stable name. Acheckpointof anotherrealm(default: the URL), user, consumer orschemais refused. -
wseOffline(
{bool disabled = false, String? path, int maxMessages = 0, int maxBytes = 0, Duration maxAge = Duration.zero}) → WseOffline -
The outbox: every message sent, except a live or signed one, waits in it
until the server answers for it, goes again after a reconnect, and
reaches the server's application once. In the file at
path(in the app's own storage), so that they outlive the app, or in memory without one. At mostmaxMessages(100,000) andmaxBytes(16 MiB) wait, the ones not answered yet included; one not written withinmaxAge(an hour) is dropped.disabled: no outbox, and a send with no connection fails, as before 3.2.
Exceptions / Errors
- WseError
-
What went wrong;
kindnames it (config, connect, auth, timeout, encryption, signing, gave_up, not_connected, full, closed, encode, decode, cancelled, busy, internal, unknown).