Documentation
¶
Index ¶
- Variables
- func EncodeEvent(evt Event) []byte
- func EncodePatches(patches []vdom.Patch) ([]byte, error)
- func InitBridge(server *Server)
- type BridgedSession
- type Decoder
- type Encoder
- type Event
- type EventType
- type MessageType
- type SchedulerBridge
- func (b *SchedulerBridge) CleanupSession(sessionID string)
- func (b *SchedulerBridge) CreateServerComponent(sessionID string, componentID string, ...) (*server.ComponentInstance, error)
- func (b *SchedulerBridge) CreateSessionScheduler(sessionID string) *scheduler.Scheduler
- func (b *SchedulerBridge) GetBridgedSession(sessionID string) (*BridgedSession, bool)
- func (b *SchedulerBridge) HandleComponentEvent(sessionID string, nodeID uint32, eventType string) error
- type Server
- type Session
Constants ¶
This section is empty.
Variables ¶
var ( ErrSessionNotFound = errors.New("session not found") ErrComponentNotFound = errors.New("component not found") ErrSchedulerNotActive = errors.New("scheduler not active") )
Error definitions
Functions ¶
func EncodePatches ¶
EncodePatches encodes patches to binary format
func InitBridge ¶
func InitBridge(server *Server)
InitBridge initializes the global scheduler bridge
Types ¶
type BridgedSession ¶
type BridgedSession struct {
Session *Session
Scheduler *scheduler.Scheduler
Components map[string]*server.ComponentInstance
}
BridgedSession represents a session with scheduler integration
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder handles decoding of live protocol messages
func (*Decoder) ReadString ¶
ReadString reads a length-prefixed string
func (*Decoder) ReadUvarint ¶
ReadUvarint reads an unsigned varint
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder handles encoding of live protocol messages
func (*Encoder) WriteBytes ¶
WriteBytes writes raw bytes
func (*Encoder) WriteString ¶
WriteString writes a length-prefixed string
func (*Encoder) WriteUvarint ¶
WriteUvarint writes an unsigned varint
type Event ¶
Event represents a client-side event
func DecodeEvent ¶
DecodeEvent decodes an event from binary format
type MessageType ¶
type MessageType uint8
MessageType represents the type of live protocol message
const ( // Frame types FramePatches MessageType = 0x00 FrameEvent MessageType = 0x01 FrameControl MessageType = 0x02 )
type SchedulerBridge ¶
type SchedulerBridge struct {
// contains filtered or unexported fields
}
SchedulerBridge connects the scheduler to the Live Protocol
func NewSchedulerBridge ¶
func NewSchedulerBridge(liveServer *Server) *SchedulerBridge
NewSchedulerBridge creates a new scheduler bridge
func (*SchedulerBridge) CleanupSession ¶
func (b *SchedulerBridge) CleanupSession(sessionID string)
CleanupSession cleans up when a session ends
func (*SchedulerBridge) CreateServerComponent ¶
func (b *SchedulerBridge) CreateServerComponent( sessionID string, componentID string, render func(ctx *vango.Context) *vdom.VNode, ) (*server.ComponentInstance, error)
CreateServerComponent creates a server-driven component instance
func (*SchedulerBridge) CreateSessionScheduler ¶
func (b *SchedulerBridge) CreateSessionScheduler(sessionID string) *scheduler.Scheduler
CreateSessionScheduler creates a scheduler for a session
func (*SchedulerBridge) GetBridgedSession ¶
func (b *SchedulerBridge) GetBridgedSession(sessionID string) (*BridgedSession, bool)
GetBridgedSession returns a bridged session
func (*SchedulerBridge) HandleComponentEvent ¶
func (b *SchedulerBridge) HandleComponentEvent(sessionID string, nodeID uint32, eventType string) error
HandleComponentEvent routes an event to a component
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles WebSocket connections for live updates
func (*Server) GetSession ¶
GetSession retrieves a session by ID
func (*Server) HandleWebSocket ¶
func (s *Server) HandleWebSocket(w http.ResponseWriter, r *http.Request)
HandleWebSocket handles WebSocket upgrade and session management
func (*Server) RemoveSession ¶
RemoveSession removes a session
type Session ¶
type Session struct {
ID string
// contains filtered or unexported fields
}
Session represents a live connection session
func (*Session) SendPatches ¶
SendPatches sends a batch of patches to the client
func (*Session) UpdateState ¶
UpdateState updates the session state and generates patches