Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

chore(plugins): mirror HostEnv.OnSSESend hook from the SDK

Gabe Kangasd070ae56b586
diff --git a/services/plugins/hostfns.go b/services/plugins/hostfns.go
index d40234653c..425a280313 100644
--- a/services/plugins/hostfns.go
+++ b/services/plugins/hostfns.go
@@ -319,6 +319,11 @@ type HostEnv struct {
// the long-lived connections. Optional; nil → owncast.sse.send is a
// no-op even if the plugin declared http.sse.
SSE *SSEHub
+ // OnSSESend, when set, is invoked for every owncast.sse.send in addition to
+ // (and independently of) SSE delivery. It exists so the test harness can
+ // observe SSE output, which otherwise vanishes when no browser client is
+ // subscribed. Production leaves it nil. Optional.
+ OnSSESend func(pluginName, channel, event string, data []byte)
// Timer schedules host-driven callbacks (owncast.timer.*). Ambient: every
// plugin gets the host functions, since a plugin can't setTimeout in the
// sandbox. Optional; nil → owncast_timer_set reports success but never
@@ -474,6 +479,9 @@ func hostSSESend(env *HostEnv, pluginName string) extism.HostFunction {
if err != nil {
return
}
+ if env.OnSSESend != nil {
+ env.OnSSESend(pluginName, channel, event, data)
+ }
if env.SSE == nil {
return
}