hub

package
v0.1.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHello       = errors.New("invalid hello")
	ErrVersionUnsupported = errors.New("protocol version unsupported")
	ErrSessionNotFound    = errors.New("session not found")
)

Functions

This section is empty.

Types

type AcceptedPeer

type AcceptedPeer struct {
	Role       protocol.Role
	Principal  auth.Principal
	SessionID  string
	Provider   string
	Resume     bool
	Subscribed []protocol.Subscription
}

type AdapterActivity

type AdapterActivity struct {
	SessionID string
	At        time.Time
}

type AdapterActivityObserver

type AdapterActivityObserver interface {
	ObserveAdapterActivity(context.Context, AdapterActivity)
}

type CommandActivity

type CommandActivity struct {
	SessionID  string
	CommandID  string
	Type       protocol.CommandType
	At         time.Time
	DurableSeq *int64
}

type CommandActivityObserver

type CommandActivityObserver interface {
	ObserveCommandActivity(context.Context, CommandActivity)
}

type EphemeralBroadcaster

type EphemeralBroadcaster interface {
	http.Handler
	EmitEphemeralEvent(context.Context, protocol.Event) error
}

func NewWebSocketHandler

func NewWebSocketHandler(cfg WebSocketConfig) EphemeralBroadcaster

type Handshake

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

func NewHandshake

func NewHandshake(cfg HandshakeConfig) *Handshake

func (*Handshake) HandleHello

func (h *Handshake) HandleHello(ctx context.Context, hello *protocol.Hello) (protocol.HelloAck, AcceptedPeer, error)

type HandshakeConfig

type HandshakeConfig struct {
	Authenticator auth.Authenticator
	EventStore    interface {
		LatestSeq(ctx context.Context, sessionID string) (int64, error)
	}
	SessionLookup SessionLookup
}

type SessionInfo

type SessionInfo struct {
	State    string
	Provider string
}

type SessionLookup

type SessionLookup interface {
	LookupSession(ctx context.Context, sessionID string) (SessionInfo, error)
}

type WebSocketConfig

type WebSocketConfig struct {
	Handshake               *Handshake
	EventStore              store.EventStore
	HandshakeTimeout        time.Duration
	CommandActivityObserver CommandActivityObserver
	AdapterActivityObserver AdapterActivityObserver
}

Jump to

Keyboard shortcuts

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