eLabSDK2.Bootloader.RpcBroker
Single host-side message dispatcher shared across every AddonChannel.
register(channel) installs the channel's incoming-message handler; on
each inbound message the broker switches on type:
rpc— resolve the dotted method path againstwindow.eLabSDK2via
the injectedSdkMethodResolver, decode args (re-hydrating
{ __addonHandler }stubs into wrapper functions via
HandlerInvoker), invoke, and postresult/errorback. A custom
section type call is served only with the calling add-on's own root
var, and any caller but an add-on frame is refused a custom
section type registration or removal and a store dispatch. A custom
section data method is not invoked on the SDK:serveSectionData
serves it with the calling add-on and the arguments as sent.addon-error— surface a runtime error from the iframe (init throw,
reinit throw, etc.) to the configuredonAddonErrorreporter.ready— tell the host the add-on has run itsinit.- anything else — ignored.
The broker holds a WeakMap of channel → HandlerInvoker so each channel
has exactly one invoker (handler ids are namespaced per channel). All
inbound errors are caught and reported as addon-error events; the
broker itself never throws to its caller.
© 2026 eLabNext
Updated 2 days ago
Did this page help you?