class

WebSocketManager

Inherits Reference < Object

WebSocket connection manager for broadcasting messages to all connected clients

Constants

Log = ::Log.for("websocket_manager")

Constructors

Class methods

instance
Source

Instance methods

broadcast(message : String)

Broadcast a message to all connected clients

Source
broadcast_json(data : Hash(String, JSON::Any::Type))

Broadcast a JSON message to all connected clients

Source
client_count

Get the number of connected clients

Source
register_socket(socket : HTTP::WebSocket)

Register a new WebSocket connection

Source
send_device_status(available : Bool, device : String, message : String | Nil = nil)

Send device status update to all clients

Source
send_info(message : String)

Send info message to all clients

Source
send_warning(message : String)

Send warning message to all clients

Source
unregister_socket(socket : HTTP::WebSocket)

Unregister a WebSocket connection

Source