module
Amber::WebSockets::ClientSockets
Overview
Manages the entire collection of ClientSockets. Manages periodic timers for socket connections (heartbeat). Also manages disconnected connection state for reconnection recovery.
Extended Modules
Defined in:
amber/websockets/client_sockets.crConstant Summary
-
Log =
::Log.for(self)
Instance Method Summary
- #add_client_socket(client_socket)
-
#buffer_message(connection_id : String, message : String)
Buffers a message for a disconnected connection.
-
#clear_disconnected_connections
Clears all disconnected connection state.
- #client_sockets
- #get_subscribers_for_topic(topic)
-
#has_disconnected_connection?(connection_id : String) : Bool
Returns whether a disconnected connection exists for the given connection_id.
-
#max_message_buffer_size=(size : Int32)
Configures the maximum message buffer size for disconnected connections.
-
#reconnect_window=(duration : Time::Span)
Configures the reconnection window duration.
-
#recover_connection(connection_id : String) : DisconnectedConnection | Nil
Attempts to recover a disconnected connection.
- #remove_client_socket(client_socket)
-
#track_disconnection(client_socket)
Stores the state of a disconnected connection so it can be recovered when the client reconnects within the reconnection window.
Instance Method Detail
Buffers a message for a disconnected connection. If the buffer is full, the oldest message is dropped.
Returns whether a disconnected connection exists for the given connection_id.
Configures the maximum message buffer size for disconnected connections.
Attempts to recover a disconnected connection. Returns the buffered messages if the connection_id is found and still within the reconnection window, otherwise returns nil.
Stores the state of a disconnected connection so it can be recovered when the client reconnects within the reconnection window.