screens

package
v0.0.0-...-363fc0a Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionInfo

type ConnectionInfo struct {
	Token string
	ID    string
	Roles []string
	Type  devices.DeviceType
}

ConnectionInfo contains authentication and identification information for a connection.

type ScreenConn

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

ScreenConn represents a WebSocket connection to a screen.

func NewScreenConn

func NewScreenConn(id, screenid string, connctx context.Context, conn *websocket.Conn, info *ConnectionInfo) *ScreenConn

NewScreenConn creates a new screen connection with the provided parameters.

func (*ScreenConn) Close

func (connh *ScreenConn) Close(err error)

Close handles the shutdown and message around closing connection, if the error is not nil it will log and report it to the listener with an websocket.StatusInternalError Or if passed as a websocket.CloseError then it grabs the code from the error

func (*ScreenConn) CloseWith

func (connh *ScreenConn) CloseWith(code websocket.StatusCode, reason string)

CloseWith closes the WebSocket connection with the specified status code and reason.

func (*ScreenConn) Context

func (sconn *ScreenConn) Context() context.Context

Context returns the connection's context.

func (*ScreenConn) Send

func (sconn *ScreenConn) Send(ctx context.Context, msg *screensv1.ServerMessages) error

Send sends a server message to the client over the WebSocket connection.

type ScreenHandler

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

ScreenHandler manages connections and messages for a single screen.

func NewScreenHandler

func NewScreenHandler(id string) *ScreenHandler

NewScreenHandler creates a new screen handler with the given ID.

func (*ScreenHandler) AddListener

func (s *ScreenHandler) AddListener(ctx context.Context, listener *ScreenConn)

AddListener adds a new listener connection to this screen.

func (*ScreenHandler) Broadcast

func (s *ScreenHandler) Broadcast(ctx context.Context, msg ...*screensv1.ServerMessage)

Broadcast sends a message to all listeners of this screen.

func (*ScreenHandler) Close

func (s *ScreenHandler) Close()

Close closes all listener connections for this screen.

func (*ScreenHandler) GetID

func (s *ScreenHandler) GetID() string

GetID returns the screen's unique identifier.

func (*ScreenHandler) HandleInitialSetupRequest

HandleInitialSetupRequest processes an initial setup request from a client.

func (*ScreenHandler) HandleMessage

HandleMessage processes a single client message and returns server responses.

func (*ScreenHandler) HandleMessages

func (s *ScreenHandler) HandleMessages(ctx context.Context, listener *ScreenConn, msg *screensv1.ClientMessages) error

HandleMessages processes a batch of client messages from a listener.

func (*ScreenHandler) HandlePingRequest

func (s *ScreenHandler) HandlePingRequest(ctx context.Context, msg *screensv1.ClientMessage_Ping) ([]*screensv1.ServerMessage, error)

HandlePingRequest processes a ping request from a client.

func (*ScreenHandler) RemoveListener

func (s *ScreenHandler) RemoveListener(id string)

RemoveListener removes a listener by ID from this screen.

type ScreenManager

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

ScreenManager manages multiple screen handlers.

func NewScreenManager

func NewScreenManager() *ScreenManager

NewScreenManager creates a new screen manager.

func (*ScreenManager) Get

func (sm *ScreenManager) Get(id string) (*ScreenHandler, bool)

Get retrieves a screen handler by ID.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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