Documentation
¶
Overview ¶
Package server implements the relay's WebSocket server.
Sessions are owned by the Server and outlive any single connection: each session's output is delivered to its current "subscriber" connection. On a client reconnect, the relay advertises live sessions (`sessions`) and the client re-attaches (`attach`) — the relay re-issues a fresh session token, replays buffered output, and resumes streaming (protocol 1.1).
Index ¶
- Constants
- type Modern
- func (m *Modern) BrowserObserver(w http.ResponseWriter, r *http.Request)
- func (m *Modern) BrowserRead(w http.ResponseWriter, r *http.Request)
- func (m *Modern) CleanShutdown() error
- func (m *Modern) CloseDirectories()
- func (m *Modern) ConfigureDirectories(paths []string) error
- func (m *Modern) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *Modern) StartWaits(state string, fetch waitFetch)
- func (m *Modern) StopWaits()
- type Server
Constants ¶
const ContractVersion = "1.0"
ContractVersion is the /v1 contract's stability version. Within a major, the stable operation set and stable capabilities keep their meaning and only grow additively; a breaking change bumps this major AND the socket name (v1.sock → v2.sock), so an older client meets no socket rather than a changed contract.
const RelayVersion = "0.6.0" // v1.2: supervisor-tree parentage + subtree kill
RelayVersion is reported in the hello message.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Modern ¶
Modern uses the legacy server's process registry. It owns durable observation and modern leases, never another process manager.
func (*Modern) BrowserObserver ¶
func (m *Modern) BrowserObserver(w http.ResponseWriter, r *http.Request)
func (*Modern) BrowserRead ¶
func (m *Modern) BrowserRead(w http.ResponseWriter, r *http.Request)
BrowserRead is deliberately a separate read-only doorway on the existing loopback listener. It never accepts the root operator token, and it never forwards a browser Origin to the private /v1 API.
func (*Modern) CleanShutdown ¶
func (*Modern) CloseDirectories ¶
func (m *Modern) CloseDirectories()
func (*Modern) ConfigureDirectories ¶
ConfigureDirectories is startup-only. Hold root descriptors for the daemon's lifetime: replacing a configured path must not silently widen authority.
func (*Modern) StartWaits ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds relay-wide state shared across connections.
func (*Server) AdoptHolders ¶
func (s *Server) AdoptHolders()
AdoptHolders re-attaches every block a previous daemon left under a holder and settles the ones whose child exited meanwhile. Called once at start, before any client can connect; each outcome is journaled explicitly.
func (*Server) BeginShutdown ¶
func (s *Server) BeginShutdown()
BeginShutdown cancels pending handshakes and closes hijacked WebSockets, which net/http.Shutdown does not own. Established processes stop in StopAll.