serverpod-server-events
Installation
SKILL.md
Serverpod Server Events
Event messaging via session.messages on named channels. Messages must be serializable models. By default (MessageScope.auto) messages are delivered across the cluster when Redis is enabled, otherwise locally within the server instance.
Sending
await session.messages.postMessage('user_updates', UserUpdate(...));
// Restrict delivery with a scope:
await session.messages.postMessage('user_updates', message, scope: MessageScope.local);
await session.messages.postMessage('user_updates', message, scope: MessageScope.global);
MessageScope.local delivers synchronously within this server only. MessageScope.global requires Redis and throws a StateError if it is not enabled. With Redis enabled, delivery is asynchronous and best effort, and listeners receive a deserialized copy of the message rather than the posted instance.
Receiving
Stream: