ws

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindCanvas  = "canvas"
	KindAgent   = "agent"
	KindFactory = "factory"
	KindUser    = "user"
	KindPublic  = "public"

	// AgentSessionTopicPrefix is shared with eventdistributer topic keys.
	AgentSessionTopicPrefix = "agent-session:"
	// FactoryTopicPrefix is shared with eventdistributer topic keys.
	FactoryTopicPrefix = "factory:"
	// UserTopicPrefix is shared with eventdistributer topic keys.
	UserTopicPrefix = "user:"
	// PublicLineTopicPrefix is the guest board socket. It carries no order payload.
	PublicLineTopicPrefix = "public-line:"
)

Variables

This section is empty.

Functions

func KindFromTopic

func KindFromTopic(topic string) string

KindFromTopic maps a hub subscription key to a low-cardinality kind label.

Types

type Client

type Client struct {
	Done chan struct{}
	// contains filtered or unexported fields
}

Client represents a connected websocket client

type Hub

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

Hub maintains the set of active clients and broadcasts messages to them

func NewHub

func NewHub() *Hub

NewHub creates a new hub

func (*Hub) BroadcastAll

func (h *Hub) BroadcastAll(message []byte)

BroadcastAll sends a message to all connected clients

func (*Hub) BroadcastToWorkflow

func (h *Hub) BroadcastToWorkflow(workflowID string, message []byte)

func (*Hub) CloseTopic

func (h *Hub) CloseTopic(topic string)

CloseTopic drops every client on a topic. The write pump closes the socket.

func (*Hub) NewClient

func (h *Hub) NewClient(conn *websocket.Conn, workflowID string) *Client

NewClient creates a new websocket client

func (*Hub) Run

func (h *Hub) Run()

Run starts the hub processing loop

func (*Hub) WorkflowSubscriberCount added in v0.21.0

func (h *Hub) WorkflowSubscriberCount(workflowID string) int

Jump to

Keyboard shortcuts

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