HorusRealtime class final
Typed server events from Thoth, as Dart streams.
final realtime = HorusRealtime(
socketUri: Uri.parse('ws://localhost:6001/app/orders-key'),
client: api,
);
final Stream<OrderUpdated> updates = realtime.stream(orderUpdated(7));
A channel is subscribed when its first listener arrives and dropped when its last one cancels, so a screen that pops stops paying for it.
Constructors
-
HorusRealtime({required Uri socketUri, HorusClient? client, String authPath = '/broadcasting/auth', Future<
void> onAuthFailure()?, RealtimeTransport? transport, Backoff? backoff, String protocol = '7'})
Properties
- authPath → String
-
Maat's channel authorization endpoint.
final
- client → HorusClient?
-
Authorizes private channels and supplies the credentials to do it with.
Only public channels work without one.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onAuthFailure
→ Future<
void> Function()? -
Called once when authorization is refused, before one retry — the hook
for refreshing an expired token. Returning normally means "try again".
final
- protocol → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- socketId → String?
-
The connection's id, or null while it is down.
no setter
- socketUri → Uri
-
Thoth's endpoint for this application,
ws://host:port/app/{key}.final - status → RealtimeStatus
-
no setter
-
statuses
→ Stream<
RealtimeStatus> -
no setter
Methods
-
close(
) → Future< void> -
connect(
) → Future< void> - Opens the connection and completes once the server has assigned a socket id. Called for you by the first stream listener.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
stream<
T> (ChannelEvent< T> event) → Stream<T> -
The typed events matching
event. Broadcast, so several widgets may listen to one channel. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited