Source Events ↗

daemon.started

HTTP server is listening.

When
After the TCP listener is bound and before serving requests.
Payload
UTF-8 bytes of the listen address, e.g. 127.0.0.1:9090.
Cancelable
No

This is the safest event for reporting daemon availability.

Use cases

  • Emit startup metrics
  • Notify external monitoring

Example

Registration and handler

Register

hook!(host, PluginEvent::DaemonStarted, on_daemon_started);

Handler

extern "C" fn on_daemon_started(ctx: *const EventContext) -> HookResult {
    let ctx = unsafe { &*ctx };
    let address = unsafe { std::slice::from_raw_parts(ctx.payload_ptr, ctx.payload_len) };
    println!("daemon listening at {}", String::from_utf8_lossy(address));
    HookResult::continue_()
}

← All lifecycle events