Skip to content

Pub/Sub for SSE channels #1914

@bpamiri

Description

@bpamiri

Phase 3 — Modernization Target #10

Add a channel abstraction over the existing SSE implementation with pub/sub support.

Design

// Controller — subscribe
function notifications() {
    subscribeToChannel(channel="user.#params.userId#", events="notification,alert");
}

// Publish from anywhere
publish(channel="user.42", event="notification", data=SerializeJSON({
    title: "New message", body: "You have a new message"
}));
  • In-memory pub/sub for single-server (wheels.Channel)
  • DatabaseAdapter for multi-server via _wheels_events table
  • subscribeToChannel() controller method wrapping initSSEStream()
  • Global publish() function
  • Ship wheels-sse.js client library for auto-reconnect

Backwards Compatibility

Existing renderSSE() / initSSEStream() / sendSSEEvent() API continues to work. Channels are a higher-level abstraction.

See design_docs/MODERNIZE-WHEELS-RIM.md §4.8 for full implementation plan.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions