ActionCable::Connection
Inherits ActionCable::ConnectionAPI < Reference < Object
Constants
Constructors
Instance methods
Sends the disconnect frame (type/reason/reconnect) and starts the WS close handshake — the gem's Connection#close.
Override (subclass or reopen) — called once on open, before the welcome message; set identifier values here.
Single gid combining all registered identifier values, sorted and colon-joined (gem's Connection#connection_identifier); nil when no identifier has a value.
Fast-path delivery: prebuilt envelope bytes from the adapter.
Override — called once the socket has closed, after channels and the internal channel are unsubscribed.
--- internal channel (gem's Connection::InternalChannel) --------- Per-connection pubsub channel the remote-connections disconnect message arrives on: "action_cable/<connection_identifier>".
raise UnauthorizedConnectionError из connect-хука — отвергнуть соединение (gem: reject_unauthorized_connection!).
Upgrade-запрос (доступен, когда connection создан ws_handler'ом; в юнит-тестах может не быть).
Cookie-заголовки upgrade-запроса (gem: request.cookies через ActionDispatch::Cookies в connection).
Верифицированная cookie-сессия фазы C (подписанный crails_session, legacy-конверт + SHA1): значение warden-ключа devise и т.п. Доступно в connect-хуке приложения:
def connect reject_unauthorized_connection! unless session["warden.user.user.key"]? self.current_user = ... end
--- fast-path subscription seam (P1.5) ---------------------------
Macros
--- identified_by (gem's Connection::Identification) ------------- Marks a key as a connection identifier index so the connection can be found later, e.g. for remote disconnect:
class ActionCable::Connection identified_by :current_user end
Deviation: identifier values are Strings (the gid of an AR object is its to_gid_param string anyway).