Function StackSSE
New Redis SSE PubSub Publisher
Creates a new SSEPublisher
that uses Redis Pub/Sub to broadcast messages across multiple servers.
This enables real-time communication between distributed instances of your app.
Config
-
RedisDb
An instance of a connected Redis client, used to send and receive messages. -
Sync Channel Name
A unique channel name used to synchronize messages between servers.
This can be any string, but must be the same across all instances sharing events.
Output
- Returns
ASSEPublisher
instance that can be used to register connections and publish events.
Create and start the SSEPublisher
once during server startup using a server hook.
Access it later with Get Registry Value
.
Avoid initializing resources like this inside API handlers.
Check the Publish SSE
function to learn how to send events using the publisher — including a complete example.