可选error失败 response 的结构化错误;其他消息类型不得携带。
请求关联 ID;普通生命周期 event 可省略,request、response、handshake、cancel 与 progress 必须提供。
可选methodcapability 或事件名;response 可省略,cancel 禁止携带。
固定协议 namespace,用于从其他页面消息中识别候选 envelope。
Runtime 创建 iframe 时分配并由双方逐条回传的实例 nonce。
可选payloadmethod 对应的 wire payload;必须在按 method 分发后继续校验。
决定 id、method、payload 与 error 组合规则的消息类别。
当前消息采用的 wire 版本;新消息使用 v2,接收端为兼容握手接受 v1。
SDK 与 Host Runtime 跨 iframe 传输时共用的顶层 bridge envelope。
备注
该类型刻意保留为宽 envelope,以同时表达 handshake、request、response、event 与 cancel。 字段组合的运行时约束由 isMiniProgramBridgeMessage 执行;v2 cancel 和 operation progress 可分别使用 MiniProgramBridgeCancelMessage 与 MiniProgramBridgeProgressMessage 获得更精确的静态类型。
类型匹配不建立信任边界。从
postMessage接收数据时,先以unknown交给 guard,再独立校验MessageEvent.source、预期 nonce、握手状态,以及具体 method 的 payload;当 origin 可以固定且 当前协议模式要求时,再校验MessageEvent.origin。