MCPcopy Create free account
hub / github.com/Monibuca/engine / WriteEvent

Method WriteEvent

util/sse.go:36–46  ·  view source on GitHub ↗
(event string, data []byte)

Source from the content-addressed store, hash-verified

34}
35
36func (sse *SSE) WriteEvent(event string, data []byte) (err error) {
37 if err = sse.Err(); err != nil {
38 return
39 }
40 buffers := net.Buffers{sseEent, []byte(event + "\n"), sseBegin, data, sseEnd}
41 _, err = buffers.WriteTo(sse.ResponseWriter)
42 if err == nil {
43 sse.ResponseWriter.(http.Flusher).Flush()
44 }
45 return
46}
47
48func NewSSE(w http.ResponseWriter, ctx context.Context) *SSE {
49 header := w.Header()

Callers

nothing calls this directly

Calls 2

FlushMethod · 0.65
WriteToMethod · 0.45

Tested by

no test coverage detected