packages/serverpod/skills/serverpod-server-events/SKILL.md
Serverpod message system — postMessage, addListener, createStream, global messages via Redis. Use when coordinating streams, sharing state across servers, or pub/sub messaging.
npx skillsauth add serverpod/serverpod serverpod-server-eventsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Event messaging via session.messages on named channels. Messages must be serializable models. Local by default; global (cross-server) with Redis.
await session.messages.postMessage('user_updates', UserUpdate(...));
// Cross-server (requires Redis):
await session.messages.postMessage('user_updates', message, global: true);
Posting with global: true throws if Redis is not enabled. Fall back to local messages only when cross-server delivery is not required.
Stream:
var stream = session.messages.createStream<UserUpdate>('user_updates');
stream.listen((message) => print('Received: $message'));
If a message on the channel is not of type T, the stream emits an error. Use exact serializable types or a deliberate shared base type.
Listener:
session.messages.addListener<UserUpdate>('user_updates', (message) {
print('Received: $message');
});
Both receive local and global messages. Streams/listeners are removed when the session closes. Remove manually with session.messages.removeListener(channel, callback). Models support inheritance, which is useful when wanting a fully typed interface for server events.
development
Build highly distinctive, production-ready Flutter interfaces with exceptional design fidelity. Include this skill whenever a user requests Flutter widgets, screens, or full apps.
testing
Serverpod Authentication — Signing in users, verify if they are authenticated, assinging scopes (e.g., admin). Use when adding features that require the user to be signed in.
development
Serverpod web server (Relic) — REST APIs, webhooks, middleware, static files, server-rendered HTML, SPAs, Flutter web. Use when adding HTTP routes, serving web pages or web apps, intercepting requests, or working with the Relic web server.
tools
Serverpod overview — what it is, project structure, how to work with. Always use at least once when working with projects that use Serverpod.