ws

package
v0.1.3-beta.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSameOrigin

func CheckSameOrigin(r *http.Request) bool

CheckSameOrigin validates that the Origin header matches the Host header, preventing cross-site WebSocket hijacking from malicious web pages.

Types

type ActivitySource

type ActivitySource interface {
	GetAllActivity() []*activity.Snapshot
}

ActivitySource provides activity snapshots for broadcasting. This avoids importing the peer package directly.

type Hub

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

Hub manages WebSocket connections for state events and tool events

func NewHub

func NewHub(stateMgr *state.Manager, tracker *toolevents.Tracker) *Hub

NewHub creates a new WebSocket hub

func (*Hub) HandleEvents

func (h *Hub) HandleEvents(w http.ResponseWriter, r *http.Request)

HandleEvents handles WebSocket connections for state event streaming

func (*Hub) Run

func (h *Hub) Run()

Run starts broadcasting state events and tool events to connected clients

func (*Hub) SetActivityTracker

func (h *Hub) SetActivityTracker(at *activity.Tracker, peerActivity ActivitySource, localHostID string, localOnly bool)

SetActivityTracker configures the hub to broadcast activity snapshots

type PTYTerminalHandler

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

PTYTerminalHandler handles WebSocket connections backed by a PTY running tmux attach

func NewPTYTerminalHandler

func NewPTYTerminalHandler(tmuxPath string, activityTracker *activity.Tracker) *PTYTerminalHandler

NewPTYTerminalHandler creates a new PTY-based terminal handler

func (*PTYTerminalHandler) HandleSession

func (h *PTYTerminalHandler) HandleSession(w http.ResponseWriter, r *http.Request)

HandleSession handles a WebSocket connection for an entire tmux session via PTY. Query params: name=<session>, cols=<cols>, rows=<rows>

Jump to

Keyboard shortcuts

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