Class: RubyLLM::MCP::Auth::Browser::CallbackServer
- Inherits:
-
Object
- Object
- RubyLLM::MCP::Auth::Browser::CallbackServer
- Defined in:
- lib/ruby_llm/mcp/auth/browser/callback_server.rb
Overview
Callback server wrapper for clean shutdown Manages server lifecycle and thread coordination
Instance Method Summary collapse
-
#initialize(server, thread, stop_proc, start_proc = nil) ⇒ CallbackServer
constructor
A new instance of CallbackServer.
-
#shutdown ⇒ nil
Shutdown server and cleanup resources.
-
#start ⇒ Object
Start callback processing loop.
Constructor Details
#initialize(server, thread, stop_proc, start_proc = nil) ⇒ CallbackServer
Returns a new instance of CallbackServer.
10 11 12 13 14 15 |
# File 'lib/ruby_llm/mcp/auth/browser/callback_server.rb', line 10 def initialize(server, thread, stop_proc, start_proc = nil) @server = server @thread = thread @stop_proc = stop_proc @start_proc = start_proc || -> {} end |
Instance Method Details
#shutdown ⇒ nil
Shutdown server and cleanup resources
24 25 26 27 28 29 30 31 |
# File 'lib/ruby_llm/mcp/auth/browser/callback_server.rb', line 24 def shutdown @stop_proc.call @server.close unless @server.closed? @thread.join(5) # Wait max 5 seconds for thread to finish rescue StandardError # Ignore shutdown errors nil end |
#start ⇒ Object
Start callback processing loop
18 19 20 |
# File 'lib/ruby_llm/mcp/auth/browser/callback_server.rb', line 18 def start @start_proc.call end |