Skip to main content

try_execute_event_handler

Function try_execute_event_handler 

Source
pub async fn try_execute_event_handler(
    state: &AppState,
    server_id: ServerId,
    connection_id: Option<ConnectionId>,
    event_type_id: &str,
    event_description: &str,
    event_data: Option<Value>,
    protocol: Option<&dyn Server>,
) -> Result<EventHandlerResult>
Expand description

Check and execute event handler for the given event

§Arguments

  • state - Application state
  • server_id - Server ID for context
  • connection_id - Optional connection ID
  • event_type_id - Event type identifier (e.g., “tcp_data_received”)
  • event_description - Human-readable event description
  • event_data - Structured event data for scripts
  • protocol - Optional protocol for action execution

§Returns

  • Ok(EventHandlerResult::Handled(...)) - Handler executed successfully
  • Ok(EventHandlerResult::FallbackToLlm { instruction: None }) - No handler or fallback requested
  • Err(_) - Handler execution failed critically