Instant notifications. Live updates. Zero delay.
Instant alerts when agents request documents or actions require attention
Live streaming of document access, approval status updates, and system events
Bidirectional communication for collaborative features and live chat
Acme Properties requested your bank statements
Just nowYour documents were successfully shared
2 seconds agoDocument access for XYZ Corp expires in 24 hours
5 minutes agoexport class NotificationRoom {
constructor(state, env) {
this.state = state;
this.connections = new Set();
}
async handleSession(websocket, userId) {
// Accept WebSocket connection
websocket.accept();
// Track connection
this.connections.add({
socket: websocket,
userId: userId
});
// Send pending notifications
const pending = await this.getPending(userId);
websocket.send(JSON.stringify(pending));
}
async broadcast(event) {
// Instant broadcast to all connections
for (const conn of this.connections) {
conn.socket.send(JSON.stringify(event));
}
}
}
Stateful edge workers maintain persistent WebSocket connections
User actions, agent requests, system events trigger notifications
Cloudflare Workers route events to appropriate Durable Objects
Push via WebSocket, SSE, or Web Push API based on client state
Track delivery status and retry if needed
Real-time notifications keep you in control of your documents