MCPcopy Create free account
hub / github.com/coder/coder / EventStream

Struct EventStream

aibridge/intercept/eventstream/eventstream.go:32–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30type event []byte
31
32type EventStream struct {
33 ctx context.Context
34 logger slog.Logger
35 clk quartz.Clock
36
37 pingPayload []byte
38
39 initiated atomic.Bool
40 initiateOnce sync.Once
41
42 shutdownOnce sync.Once
43 eventsCh chan event
44
45 // doneCh is closed when the start loop exits.
46 doneCh chan struct{}
47
48 // tick sends periodic pings to keep the connection alive.
49 tick *time.Ticker
50}
51
52// NewEventStream creates a new SSE stream, with an optional payload which is used to send pings every [pingInterval].
53func NewEventStream(ctx context.Context, logger slog.Logger, pingPayload []byte, clk quartz.Clock) *EventStream {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected