serverpod_live_client 0.1.1 copy "serverpod_live_client: ^0.1.1" to clipboard
serverpod_live_client: ^0.1.1 copied to clipboard

Typed, resumable real-time channels, collections, commands, and presence for Serverpod.

serverpod_live_client #

Headless Dart APIs for typed Serverpod Live channels, commands, collections, and presence. This package has no Flutter or state-management dependency.

Install #

dependencies:
  serverpod_live_client: ^0.1.0

The consuming app also needs its generated Serverpod module client.

Subscribe to a typed channel #

final live = LiveClient(Caller(serverpodClient));
final channel = live.channel<String>(
  name: 'team:acme:todos',
  codec: todoChangedCodec,
);

channel.events.listen((event) {
  applyTodoChange(event.value);
});
channel.resume();

A LiveEventCodec<T> defines the event type and JSON encoding for the app's domain model. Channels retain their contiguous cursor, reconnect after loss, and suppress duplicate cursors. Durable delivery is at least once and ordered per channel.

Example #

example/main.dart defines a small typed todo event and opens a channel with an application's generated module caller.

Use LiveClient.collection for snapshot-backed collections. If retained history cannot cover the channel cursor, the collection loads a fresh snapshot before resubscribing. Commands are server-authoritative and idempotent by client command ID; application state changes only after durable live events.

Presence is separate and ephemeral. The client contract is the same for local and Redis-backed server deployments. See the repository README for server setup and complete examples.

0
likes
150
points
21
downloads

Documentation

API reference

Publisher

verified publishersumitgohil.com

Weekly Downloads

Typed, resumable real-time channels, collections, commands, and presence for Serverpod.

Repository (GitHub)
View/report issues

Topics

#serverpod #realtime #collaboration

License

Apache-2.0 (license)

Dependencies

serverpod_client, uuid

More

Packages that depend on serverpod_live_client