Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectedClient ¶
type ConnectedClient struct {
ID int64
Connection *websocket.Conn
SendMessage chan []byte
EntityFilter map[string]bool
// contains filtered or unexported fields
}
ConnectedClient represents a single WebSocket client connection
type DataChangeEvent ¶
type DataChangeEvent struct {
Type EventType `json:"type"`
Entity string `json:"entity"`
Data any `json:"data"`
Timestamp time.Time `json:"timestamp"`
}
DataChangeEvent represents a change in our data that clients should know about
type SocketManager ¶
type SocketManager struct {
// contains filtered or unexported fields
}
SocketManager manages all WebSocket connections and broadcasts events
func NewSocketManager ¶
func NewSocketManager() *SocketManager
NewSocketManager creates and initializes a new WebSocket manager
func (*SocketManager) BroadcastEvent ¶
func (manager *SocketManager) BroadcastEvent(eventType EventType, entity string, data any)
BroadcastEvent broadcasts a data change event to all connected clients This is the public method that repositories will call
func (*SocketManager) HandleWebSocket ¶
func (manager *SocketManager) HandleWebSocket(response http.ResponseWriter, request *http.Request)
HandleWebSocket upgrades HTTP connections to WebSocket and manages the client lifecycle This is the HTTP handler function for WebSocket connections
func (*SocketManager) Run ¶
func (manager *SocketManager) Run()
Run starts the WebSocket manager's main event loop This should be run as a goroutine