Skip to content

Host Bridge Protocol

Companion SDK 使用小型 JSON-RPC protocol 与 Vifu host 通信。Game code 应使用 SDK API,不要直接发送 protocol message。

MethodDirectionDescription
companion.initializehost to game初始化 bridge。
companion.contexts/listhost to game列出 registered context。
companion.contexts/readhost to game读取 context snapshot。
companion.commands/listhost to game列出 registered command。
companion.commands/callhost to game请求 game command。
companion.observegame to host发送 observation。
companion.signalgame to host发送 signal。

Game 拥有 state 和 command。Host 可以 request command execution,但 input validation 和 state change 由 game 负责。