Protocol Profile

不同 WebSocket 服务的 JSON 字段名不同(`type` / `event` / JSON-RPC 等)。Profile 是一组**文件头默认值 + 示例**,让你用同一套 `--` / 单词返回语法适配多种协议,而不改 Flow 核心写法。

Profile 是一组文件头默认值 + 文档化示例;Flow 语法本身不变。

type-profile(默认,# profile type)

常见:{"type":"subscribe","channel":"ticker"} dispatch: type 条件示例:--subscribe --channel=ticker 返回简写:subscribed → {"type":"subscribed"}

event-profile(# profile event)

常见:{"event":"message","text":"hello"} dispatch: event 条件:--message --event=welcome 简写:welcome → {"event":"welcome"}

action-profile(# profile action)

常见:{"action":"join","room":"live"} dispatch: action

jsonrpc-profile(# profile jsonrpc)

常见:{"jsonrpc":"2.0","method":"login","id":1,"params":{...}} dispatch: method // 简写慎用;推荐完整 JSON 返回 条件:--method=login --id=1 返回:{"jsonrpc":"2.0","id":"$id","result":{"ok":true}}

op-profile(# profile op)

常见:{"op":10,"d":{...}}(Discord 等网关) dispatch: op // 数值 op 时不用单词简写,用 --op=10 + JSON 返回

text-profile(# profile text + # format text)

纯文本或 Socket.IO 类:42["join","room1"] 条件:--=42["join","room1"] 返回:42["joined","room1"] JSON 消息条件不适用;整帧用 --=

自定义

# profile custom
# dispatch cmd
# format json

Profile 只影响默认值;正文中仍可用任意字段名写 --method= / --event=,不被 profile 限制。