Documentation
¶
Index ¶
- func FindPort(startPort int) (string, error)
- type LoopStateProvider
- type Options
- type Server
- type SessionEventBroker
- func (b *SessionEventBroker) PublishSessionDelta(sessionID string, text string, ts time.Time)
- func (b *SessionEventBroker) PublishSessionEvent(sessionID string, ev event.Event)
- func (b *SessionEventBroker) Subscribe(sessionID string, sub Subscriber)
- func (b *SessionEventBroker) Unsubscribe(sessionID string, sub Subscriber)
- func (b *SessionEventBroker) UnsubscribeAll(sub Subscriber)
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LoopStateProvider ¶
type Options ¶
type Options struct {
RuntimeDir string
Addr string // host:port, defaults to "127.0.0.1:0"
Now func() time.Time
UI fs.FS // embedded SPA assets; nil = placeholder only
Config *config.Config // project config; nil = zero config
LoopStateProvider LoopStateProvider
Warnings []string
Broker *SessionEventBroker
}
Options configures the HTTP server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves the web UI API.
type SessionEventBroker ¶
type SessionEventBroker struct {
// contains filtered or unexported fields
}
SessionEventBroker implements dispatcher.SessionEventSink. Fans out session events to subscribed WebSocket clients.
func NewSessionEventBroker ¶
func NewSessionEventBroker() *SessionEventBroker
func (*SessionEventBroker) PublishSessionDelta ¶
func (b *SessionEventBroker) PublishSessionDelta(sessionID string, text string, ts time.Time)
PublishSessionDelta broadcasts an ephemeral text delta to subscribers.
func (*SessionEventBroker) PublishSessionEvent ¶
func (b *SessionEventBroker) PublishSessionEvent(sessionID string, ev event.Event)
PublishSessionEvent implements dispatcher.SessionEventSink. Converts event.Event -> EventLine, serializes, fans out.
func (*SessionEventBroker) Subscribe ¶
func (b *SessionEventBroker) Subscribe(sessionID string, sub Subscriber)
func (*SessionEventBroker) Unsubscribe ¶
func (b *SessionEventBroker) Unsubscribe(sessionID string, sub Subscriber)
func (*SessionEventBroker) UnsubscribeAll ¶
func (b *SessionEventBroker) UnsubscribeAll(sub Subscriber)
type Subscriber ¶
type Subscriber interface {
Send(msg []byte) bool // false if client is slow/dead
Close() // disconnect the client
}
Subscriber receives serialized messages. Decoupled from wsClient.