Trilium Electron API
    Preparing search index...

    Interface ElectronWsApi

    In-process replacement for the renderer↔server WebSocket. Backed by Chromium IPC instead of a TCP socket — no port is bound and no auth check is needed because the channel is only reachable from the renderer the BrowserWindow owns. Wire format is whatever the server's MessagingProvider accepts (currently WebSocketMessage / log-error / log-info / ping).

    interface ElectronWsApi {
        onMessage(callback: (message: unknown) => void): () => void;
        send(message: unknown): void;
    }
    Index

    Methods

    Methods

    • Subscribes to messages pushed from the main process. Returns an unsubscribe function — call it when the listener is no longer needed (e.g. when a BrowserWindow is unloaded) to avoid leaking handlers.

      Parameters

      • callback: (message: unknown) => void

      Returns () => void

    • Sends a message from the renderer to the main-process messaging hub.

      Parameters

      • message: unknown

      Returns void