Skip to content

Host Bridge Protocol

Package@consenger/companion-sdk@0.1.0-alpha.0
Protocolcompanion.plugin.v1
Runtimeiframe / WKWebView
StatusPublic alpha

The Companion SDK speaks a small JSON-RPC protocol with the Vifu host. Game code should use SDK methods instead of sending protocol messages directly.

Sources

SourceDirectionPurpose
consenger-game-runtimegame to hostRuntime notifications and responses.
consenger-web-hosthost to gameVifu Web requests.
consenger-ios-hosthost to gameiOS WKWebView requests.

Core methods

MethodDirectionDescription
companion.initializehost to gameInitializes the bridge and marks the host connected.
companion.contexts/listhost to gameLists registered contexts.
companion.contexts/readhost to gameReads a context snapshot.
companion.commands/listhost to gameLists registered commands.
companion.commands/callhost to gameRequests a game command.
companion.observegame to hostSends a routine observation.
companion.signalgame to hostSends a companion-visible signal.
companion.runtime_readygame to hostAnnounces browser bundle readiness.

Rule

The game owns state and commands. The host may request command execution, but the game validates inputs and decides what changes.