kernl API
    Preparing search index...

    Function createCompositeBackend

    • Build one MessagingBackend that spans every enabled provider.

      Conversation and message ids leaving the composite are namespaced as "<providerId>:<innerId>"; ids arriving from callers are split on the first : to find the provider. Pagination cursors for conversations() are namespaced the same way and are only produced when exactly one provider is involved; with several providers the merged page carries no cursor, because no single provider can resume it.

      close() is a no-op: the registry that enabled the backends owns their lifetime and closes them through MessagingRegistry.close(). Unsubscribing a composite subscription skips providers that were disabled in the meantime, since disabling already closed their backend.

      Parameters

      • resolveEnabled: () => readonly EnabledBackend[]

        Returns the currently enabled providers, in order.

      • getDefault: () => string | undefined

        Returns the id of the provider used for sends that name none.

      Returns MessagingBackend

      A backend suitable for createDmService.

      const dm = createCompositeBackend(
      () => [{ id: 'private', backend: privateBackend }],
      () => 'private',
      );
      const page = await dm.conversations({ limit: 20 });
      page.conversations[0]?.id; // 'private:direct:ab,cd'