Source Events ↗

daemon.stopping

Daemon is shutting down.

When
After the HTTP server stops, before plugin shutdown callbacks run.
Payload
Empty.
Cancelable
No

Release resources here if you need ordering before plugin shutdown.

Use cases

  • Flush queues
  • Close external connections

Example

Registration and handler

Register

hook!(host, PluginEvent::DaemonStopping, on_daemon_stopping);

Handler

extern "C" fn on_event(ctx: *const EventContext) -> HookResult {
    let ctx = unsafe { &*ctx };
    let payload = unsafe { std::slice::from_raw_parts(ctx.payload_ptr, ctx.payload_len) };
    let _json = std::str::from_utf8(payload).unwrap_or_default();
    HookResult::r#continue()
}

← All lifecycle events