dsh-event-relay
消息通讯 活跃维护

dsh-event-relay

joao-paulo-santos/dsh-event-relay

SSE通道实现主机侧事件中继,可将服务端通知实时推送给已订阅的浏览器端,支持服务端按主题前缀过滤消息,内置断线重连信号机制,保障推送链路稳定可靠。

1
Stars 标星
0
Forks 分支
1
Watchers 关注
0
Open Issues
JavaScript
主要语言
None
开源协议
4 KB
仓库大小
3 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:joao-paulo-santos/dsh-event-relay
git clone https://github.com/joao-paulo-santos/dsh-event-relay.git
git clone git@github.com:joao-paulo-santos/dsh-event-relay.git
README.md main

dsh-event-relay

The ONE host→browser push channel for DSH plugins: a single SSE route
(/relay/events) that holds every subscriber's response open and streams
JSON frames {"topic","payload"} as things happen.

Producers (host plugins)

const relay = ctx.get('eventRelay')            // optional — degrade if absent
relay.publish('my-topic', payload)             // direct
relay.forward('my/event')                      // tap an existing Cordis event (idempotent)

Consumers (browser bundles)

const relay = ctx.get('eventRelay')            // provided by this package's client half
const off = relay.subscribe('kanban', (topic, payload) => { ... })  // prefix match
// or raw: new EventSource('/relay/events?topics=kanban,notifications')

Design

Transport, not a bus: Cordis events remain the host-side event system; this
only carries them across the plane boundary. Liveness, not correctness —
consumers should fall back to pull-on-focus when the relay is absent.
Route roots are composition-level contracts (/api, /plugins,
/workspace-history, /notifications, /granular-settings are taken).