{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://moji.kaitoranma.com/docs/schemas/subscribe-client-message.json",
  "title": "SubscribeClientMessage",
  "description": "Subscribe（/v1/subscribe）でクライアントが送るメッセージを表す。",
  "oneOf": [
    {
      "$ref": "#/$defs/Hello"
    },
    {
      "$ref": "#/$defs/Ping"
    }
  ],
  "$defs": {
    "Hello": {
      "title": "hello",
      "description": "クライアントは、接続の直後に hello を 1 回だけ送る。",
      "type": "object",
      "required": [
        "type",
        "protocolVersion",
        "token"
      ],
      "properties": {
        "type": {
          "const": "hello"
        },
        "protocolVersion": {
          "$ref": "common.json#/$defs/ProtocolVersion"
        },
        "token": {
          "$ref": "common.json#/$defs/Token"
        }
      }
    },
    "Ping": {
      "title": "ping",
      "description": "ブラウザは WebSocket の ping フレームを扱えないので、クライアントは、生存確認とプロキシのアイドル切断の防止のために ping を送る。文字おこしくんは pong を返す。",
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "ping"
        }
      }
    }
  }
}
