serverpod-server-events
Serverpod message system — postMessage, addListener, createStream, global messages via Redis. Use when coordinating streams, sharing state across servers, or pub/sub messaging.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Serverpod Server Events
Event messaging via session.messages on named channels. Messages must be serializable models. Local by default; global (cross-server) with Redis.
Sending
session.messages.postMessage('user_updates', UserUpdate(...));
// Cross-server (requires Redis):
session.messages.postMessage('user_updates', message, global: true);
Receiving
Stream:
var stream = session.messages.createStream<UserUpdate>('user_updates');
stream.listen((message) => print('Received: $message'));
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.
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-03-11
- Index updated
- 2026-03-11
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!