ws

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package ws will implement the WebSocket transport for the control plane. Lands in v0.2 alongside the mcpserver stdio transport.

WebSocket framing carries the canonical event envelope verbatim (see § Protocol versioning → Canonical event envelope); reconnect resumes from `lastEventId` query param.

Until then this package is intentionally empty; the architecture doc commits to the surface at § WebSocket surface.

Package ws implements the WebSocket transport for the control plane. Pure stdlib + crypto/sha1; RFC 6455 frame format.

Frames carry the canonical event envelope verbatim per the architecture doc § Canonical event envelope:

{"frame":"command","body": <Command envelope>}    client → engine
{"frame":"event","body":   <Event envelope>}      engine → client

Reconnect resumes from a `lastEventId` query param on the connection URL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is one upgraded WebSocket connection wrapped as a control.Client.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) ID

func (c *Conn) ID() ids.ClientID

func (*Conn) IdentityClass

func (c *Conn) IdentityClass() control.IdentityClass

func (*Conn) Send

func (c *Conn) Send(_ context.Context, _ control.Command) error

func (*Conn) Subscribe

func (c *Conn) Subscribe(_ context.Context) <-chan control.EventEnvelope

type Handler

type Handler struct {
	Mux         *multiplex.Mux
	Encoder     *auth.Encoder
	Revocations *auth.RevocationList

	// Optional Host/Origin guards (same shape as REST).
	AllowedHosts   []string
	AllowedOrigins []string
}

Handler is the WebSocket-upgrading HTTP handler. Configure with the mux + auth before mounting.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler. Path is /v1/ws?session=<id>[&lastEventId=N].

Jump to

Keyboard shortcuts

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