Help us shape the future of Go! Take the 2026 Go Developer Survey

stream

package
v2.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package stream defines the multiplexed client stream: one connection that carries every live channel the caller asked for.

Browsers cap concurrent HTTP/1.1 requests per origin at six, and every long-lived stream permanently consumes one of them. Multiplexing keeps that budget for ordinary requests, and gives the client a single reconnect and heartbeat to reason about instead of one per feature.

Index

Constants

View Source
const (
	ChannelEnvironments = "environments"
	ChannelDashboard    = "dashboard"
	ChannelActivities   = "activities"
	ChannelEvents       = "events"
	ChannelVersion      = "version"
)

Channel names a subscribable feed. Callers request channels explicitly because they differ enormously in cost: environments is one local query, while dashboard proxies a request to every remote agent on every tick.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// Channel identifies which feed produced this event. Empty on a heartbeat.
	//
	// Required: false
	Channel string `json:"channel,omitempty"`

	// Type is set to "heartbeat" for connection keepalives; otherwise the
	// per-channel payload carries its own type.
	//
	// Required: false
	Type string `json:"type,omitempty"`

	// Dashboard carries a ChannelDashboard payload.
	//
	// Required: false
	Dashboard *dashboardtypes.StreamEvent `json:"dashboard,omitempty"`

	// Activity carries a ChannelActivities payload.
	//
	// Required: false
	Activity *activitytypes.StreamEvent `json:"activity,omitempty"`

	// Environment carries a ChannelEnvironments payload.
	//
	// Required: false
	Environment *environmenttypes.StreamEvent `json:"environment,omitempty"`

	// EventLog carries a ChannelEvents invalidation.
	//
	// Required: false
	EventLog *eventtypes.StreamEvent `json:"eventLog,omitempty"`

	// Version carries a ChannelVersion payload.
	//
	// Required: false
	Version *versiontypes.StreamEvent `json:"version,omitempty"`

	// Timestamp is when the envelope was produced.
	//
	// Required: true
	Timestamp time.Time `json:"timestamp"`
}

Event is the JSON data of one message in the multiplexed SSE stream. Exactly one payload is set, retaining its channel's event type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL