Class: Events::Subscribers::AuthenticationBroadcaster
- Inherits:
-
Object
- Object
- Events::Subscribers::AuthenticationBroadcaster
- Includes:
- Events::Subscriber
- Defined in:
- lib/events/subscribers/authentication_broadcaster.rb
Overview
Reacts to AuthenticationRequired by surfacing the provider rejection to the operator. Emits a system_message into the conversation (so the failure lives in history) and broadcasts an authentication_required frame on the session’s ActionCable stream (so the TUI can prompt for a new token).
Follows the same shape as SessionStateBroadcaster: jobs emit typed events, broadcasters own the ActionCable side.
Instance Method Summary collapse
Instance Method Details
#emit(event) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/events/subscribers/authentication_broadcaster.rb', line 17 def emit(event) payload = event[:payload] session_id = payload[:session_id] = payload[:content] Events::Bus.emit(Events::SystemMessage.new( content: "Authentication failed: #{}", session_id: session_id )) ActionCable.server.broadcast( "session_#{session_id}", {"action" => "authentication_required", "message" => } ) end |