Documentation
¶
Index ¶
- Constants
- func NewHTTPLogger(component string, verbose bool) *logging.Logger
- func NewHTTPLoggerWithLevel(component string, verbose bool, level entities.LogLevel) *logging.Logger
- type ClientMessage
- type ClientMode
- type ConfigResponse
- type Connection
- type ConnectionManager
- type ErrorResponse
- type PresenterHandler
- func NewPresenterHandler(sync ports.PresentationSync) *PresenterHandler
- func NewPresenterHandlerFull(sync ports.PresentationSync, config *entities.ServerConfig, ...) *PresenterHandler
- func NewPresenterHandlerWithConfig(sync ports.PresentationSync, config *entities.ServerConfig) *PresenterHandler
- func NewPresenterHandlerWithLogging(sync ports.PresentationSync, loggingConfig *entities.LoggingConfig) *PresenterHandler
- func (h *PresenterHandler) HandleNavigation(w http.ResponseWriter, r *http.Request)
- func (h *PresenterHandler) HandlePresenterView(w http.ResponseWriter, r *http.Request)
- func (h *PresenterHandler) HandleState(w http.ResponseWriter, r *http.Request)
- func (h *PresenterHandler) HandleTimer(w http.ResponseWriter, r *http.Request)
- func (h *PresenterHandler) HandleWebSocket(w http.ResponseWriter, r *http.Request)
- func (h *PresenterHandler) RegisterRoutes(router *mux.Router)
- type Server
- func (s *Server) BroadcastFileChange(filename string)
- func (s *Server) BroadcastReload()
- func (s *Server) GetPresentation() *entities.Presentation
- func (s *Server) IsRunning() bool
- func (s *Server) NotifyClients(event ports.UpdateEvent) error
- func (s *Server) SetExportService(exportService ports.ExportService)
- func (s *Server) SetLogger(verbose bool)
- func (s *Server) SetOptimizationService(optimizationSvc *optimization.OptimizationService)
- func (s *Server) SetPresentation(p *entities.Presentation)
- func (s *Server) SetSyncService(syncService ports.PresentationSync)
- func (s *Server) Start(ctx context.Context, port int, host string) error
- func (s *Server) Stop(ctx context.Context) error
- type SlideResponse
- type SlidesResponse
- type WebSocketClient
Constants ¶
const ( // DefaultShutdownTimeout is the maximum time to wait for active connections // to complete during graceful shutdown. 5 seconds allows most in-flight requests // to complete while preventing indefinite hangs during shutdown. DefaultShutdownTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func NewHTTPLogger ¶
NewHTTPLogger creates a new HTTP logger instance using the shared logging package. HTTP server loggers always log Info messages (don't require verbose=true).
Types ¶
type ClientMessage ¶
ClientMessage represents a message received from the client
type ClientMode ¶
type ClientMode string
ClientMode represents the type of WebSocket client
const ( ClientModeAudience ClientMode = "audience" ClientModePresenter ClientMode = "presenter" )
type ConfigResponse ¶
type ConfigResponse struct {
Version string `json:"version"`
Theme string `json:"theme"`
WebSocketURL string `json:"websocket_url"`
LiveReload bool `json:"live_reload"`
SupportedThemes []string `json:"supported_themes"`
}
ConfigResponse represents the configuration API response
type Connection ¶
type Connection struct {
ID string
Send chan ports.UpdateEvent
// contains filtered or unexported fields
}
Connection represents a WebSocket connection
func (*Connection) Close ¶
func (c *Connection) Close()
Close safely closes the connection's send channel exactly once. It is safe to call this method multiple times.
type ConnectionManager ¶
type ConnectionManager struct {
// contains filtered or unexported fields
}
ConnectionManager manages WebSocket connections
func NewConnectionManager ¶
func NewConnectionManager() *ConnectionManager
NewConnectionManager creates a new connection manager
func (*ConnectionManager) Broadcast ¶
func (cm *ConnectionManager) Broadcast(event ports.UpdateEvent)
Broadcast sends an event to all connections. If the broadcast channel is full and cannot accept the event within broadcastTimeout, the event is dropped and a warning is logged.
func (*ConnectionManager) CloseAll ¶
func (cm *ConnectionManager) CloseAll()
CloseAll closes all connections
func (*ConnectionManager) RegisterConnection ¶
func (cm *ConnectionManager) RegisterConnection(conn *Connection)
RegisterConnection adds a new connection directly
func (*ConnectionManager) Run ¶
func (cm *ConnectionManager) Run(ctx context.Context)
Run starts the connection manager main loop
func (*ConnectionManager) Unregister ¶
func (cm *ConnectionManager) Unregister(connID string)
Unregister removes a connection
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Message string `json:"message"`
Time time.Time `json:"time"`
}
ErrorResponse represents an error response
type PresenterHandler ¶
type PresenterHandler struct {
// contains filtered or unexported fields
}
PresenterHandler handles presenter mode requests
func NewPresenterHandler ¶
func NewPresenterHandler(sync ports.PresentationSync) *PresenterHandler
NewPresenterHandler creates a new presenter handler Deprecated: Use NewPresenterHandlerWithConfig instead for proper origin validation
func NewPresenterHandlerFull ¶
func NewPresenterHandlerFull(sync ports.PresentationSync, config *entities.ServerConfig, loggingConfig *entities.LoggingConfig) *PresenterHandler
NewPresenterHandlerFull creates a new presenter handler with full configuration
func NewPresenterHandlerWithConfig ¶
func NewPresenterHandlerWithConfig(sync ports.PresentationSync, config *entities.ServerConfig) *PresenterHandler
NewPresenterHandlerWithConfig creates a new presenter handler with server config for origin validation
func NewPresenterHandlerWithLogging ¶
func NewPresenterHandlerWithLogging(sync ports.PresentationSync, loggingConfig *entities.LoggingConfig) *PresenterHandler
NewPresenterHandlerWithLogging creates a new presenter handler with logging configuration Deprecated: Use NewPresenterHandlerFull instead for proper origin validation
func (*PresenterHandler) HandleNavigation ¶
func (h *PresenterHandler) HandleNavigation(w http.ResponseWriter, r *http.Request)
HandleNavigation handles navigation requests
func (*PresenterHandler) HandlePresenterView ¶
func (h *PresenterHandler) HandlePresenterView(w http.ResponseWriter, r *http.Request)
HandlePresenterView serves the presenter mode interface
func (*PresenterHandler) HandleState ¶
func (h *PresenterHandler) HandleState(w http.ResponseWriter, r *http.Request)
HandleState returns the current presenter state
func (*PresenterHandler) HandleTimer ¶
func (h *PresenterHandler) HandleTimer(w http.ResponseWriter, r *http.Request)
HandleTimer handles timer control requests
func (*PresenterHandler) HandleWebSocket ¶
func (h *PresenterHandler) HandleWebSocket(w http.ResponseWriter, r *http.Request)
HandleWebSocket handles WebSocket connections for real-time sync
func (*PresenterHandler) RegisterRoutes ¶
func (h *PresenterHandler) RegisterRoutes(router *mux.Router)
RegisterRoutes registers presenter mode routes
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the HTTPServer interface
func NewServer ¶
func NewServer(presenter ports.PresentationService, renderer ports.Renderer, config *entities.ServerConfig) (*Server, error)
NewServer creates a new HTTP server config must not be nil - use config.GetDefaultConfig().Server if needed Returns an error if config is nil
func NewServerWithLogging ¶
func NewServerWithLogging(presenter ports.PresentationService, renderer ports.Renderer, config *entities.ServerConfig, loggingConfig *entities.LoggingConfig) (*Server, error)
NewServerWithLogging creates a new HTTP server with logging configuration Returns an error if config is nil
func (*Server) BroadcastFileChange ¶
BroadcastFileChange sends a file change event to all connected clients
func (*Server) BroadcastReload ¶
func (s *Server) BroadcastReload()
BroadcastReload sends a reload event to all connected clients
func (*Server) GetPresentation ¶
func (s *Server) GetPresentation() *entities.Presentation
GetPresentation returns the current presentation
func (*Server) NotifyClients ¶
func (s *Server) NotifyClients(event ports.UpdateEvent) error
NotifyClients sends an update event to all connected clients
func (*Server) SetExportService ¶
func (s *Server) SetExportService(exportService ports.ExportService)
SetExportService sets the export service
func (*Server) SetOptimizationService ¶
func (s *Server) SetOptimizationService(optimizationSvc *optimization.OptimizationService)
SetOptimizationService sets the optimization service
func (*Server) SetPresentation ¶
func (s *Server) SetPresentation(p *entities.Presentation)
SetPresentation sets the current presentation
func (*Server) SetSyncService ¶
func (s *Server) SetSyncService(syncService ports.PresentationSync)
SetSyncService sets the presentation sync service
type SlideResponse ¶
type SlideResponse struct {
Index int `json:"index"`
Title string `json:"title"`
HTML string `json:"html"`
Notes string `json:"notes,omitempty"`
}
SlideResponse represents a single slide in the API response
type SlidesResponse ¶
type SlidesResponse struct {
Title string `json:"title"`
Author string `json:"author,omitempty"`
Date string `json:"date,omitempty"`
Theme string `json:"theme"`
Slides []SlideResponse `json:"slides"`
}
SlidesResponse represents the slides API response
type WebSocketClient ¶
type WebSocketClient struct {
// contains filtered or unexported fields
}
WebSocketClient represents a WebSocket client connection