{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://docs.githubim.com/contracts/json-rpc.experimental.schema.json","title":"WuKongIM WebSocket JSON-RPC codec schema (experimental)","description":"Bounded WebSocket JSON-RPC shapes. Product Gateway supports the pinned EasySDK CONNECT, ping, online SEND/SENDACK, and RECV/RECVACK path; other JSON-RPC methods remain experimental.","x-wukongim-stability":"experimental-easysdk-core-supported","anyOf":[{"$ref":"#/$defs/ConnectRequest"},{"$ref":"#/$defs/SendRequest"},{"$ref":"#/$defs/PingRequest"},{"$ref":"#/$defs/DisconnectRequest"},{"$ref":"#/$defs/SubscribeRequest"},{"$ref":"#/$defs/UnsubscribeRequest"},{"$ref":"#/$defs/RecvAckNotification"},{"$ref":"#/$defs/RecvNotification"},{"$ref":"#/$defs/EventNotification"},{"$ref":"#/$defs/DisconnectNotification"},{"$ref":"#/$defs/ConnectResponse"},{"$ref":"#/$defs/SendResponse"},{"$ref":"#/$defs/PongResponse"},{"$ref":"#/$defs/ErrorResponse"},{"$ref":"#/$defs/GenericResponse"}],"$defs":{"JSONRPCVersion":{"type":"string","const":"2.0"},"RequestBase":{"type":"object","required":["method","id"],"properties":{"jsonrpc":{"$ref":"#/$defs/JSONRPCVersion"},"method":{"type":"string"},"id":{"type":"string","minLength":1}}},"NotificationBase":{"type":"object","required":["method"],"properties":{"jsonrpc":{"$ref":"#/$defs/JSONRPCVersion"},"method":{"type":"string"}},"not":{"required":["id"]}},"ResponseBase":{"type":"object","required":["id"],"properties":{"jsonrpc":{"$ref":"#/$defs/JSONRPCVersion"},"id":{"type":"string","minLength":1}},"not":{"required":["method"]}},"Header":{"type":"object","properties":{"noPersist":{"type":"boolean"},"no_persist":{"type":"boolean"},"redDot":{"type":"boolean"},"red_dot":{"type":"boolean"},"syncOnce":{"type":"boolean"},"sync_once":{"type":"boolean"},"dup":{"type":"boolean"},"end":{"type":"boolean"}}},"Setting":{"type":"object","properties":{"receipt":{"type":"boolean"},"signal":{"type":"boolean"},"stream":{"type":"boolean"},"topic":{"type":"boolean"}}},"ErrorObject":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":true}},"ConnectParams":{"type":"object","properties":{"header":{"$ref":"#/$defs/Header"},"version":{"type":"integer","description":"0 defaults to protocol v6 before bridging."},"clientKey":{"type":"string"},"client_key":{"type":"string"},"deviceId":{"type":["string","null"]},"device_id":{"type":["string","null"]},"deviceFlag":{"type":"integer"},"device_flag":{"type":"integer"},"clientTimestamp":{"type":"integer","format":"int64"},"client_timestamp":{"type":"integer","format":"int64"},"uid":{"type":"string"},"token":{"type":"string"}}},"ConnectRequest":{"allOf":[{"$ref":"#/$defs/RequestBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"connect"},"params":{"$ref":"#/$defs/ConnectParams"}}}],"x-wukongim-product-status":"supported-easysdk-connect-first"},"SendParams":{"type":"object","properties":{"header":{"$ref":"#/$defs/Header"},"setting":{"$ref":"#/$defs/Setting"},"msgKey":{"type":"string"},"msg_key":{"type":"string"},"expire":{"type":"integer","format":"uint32","minimum":0},"clientMsgNo":{"type":"string"},"client_msg_no":{"type":"string"},"streamNo":{"type":"string"},"stream_no":{"type":"string"},"channelId":{"type":"string"},"channel_id":{"type":"string"},"channelType":{"type":"integer"},"channel_type":{"type":"integer"},"topic":{"type":"string"},"payload":{"oneOf":[{"type":"string","description":"A JSON-text string as emitted by EasySDK Android v1.0.5, which retains the same wire shape as v1.0.4 and v1.0.3, or Base64 as emitted by the pinned Flutter and JavaScript clients. Valid JSON text takes precedence when decoding."},{"type":"object"},{"type":"null"}]}}},"SendRequest":{"allOf":[{"$ref":"#/$defs/RequestBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"send"},"params":{"$ref":"#/$defs/SendParams"}}}],"x-wukongim-product-status":"supported-after-connect-with-request-id-correlation"},"PingRequest":{"allOf":[{"$ref":"#/$defs/RequestBase"},{"type":"object","properties":{"method":{"const":"ping"},"params":{"type":["object","null"],"maxProperties":0}}}],"x-wukongim-product-status":"works"},"DisconnectParams":{"type":"object","properties":{"reasonCode":{"type":"integer"},"reason":{"type":"string"}}},"DisconnectRequest":{"allOf":[{"$ref":"#/$defs/RequestBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"disconnect"},"params":{"$ref":"#/$defs/DisconnectParams"}}}],"x-wukongim-product-status":"decoded-but-product-handler-rejects-disconnect"},"SubscribeParams":{"type":"object","properties":{"subNo":{"type":"string"},"channelId":{"type":"string"},"channelType":{"type":"integer"},"param":{"type":"string"}}},"SubscribeRequest":{"allOf":[{"$ref":"#/$defs/RequestBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"subscribe"},"params":{"$ref":"#/$defs/SubscribeParams"}}}],"x-wukongim-product-status":"decoder-only-bridge-missing"},"UnsubscribeParams":{"type":"object","properties":{"subNo":{"type":"string"},"channelId":{"type":"string"},"channelType":{"type":"integer"}}},"UnsubscribeRequest":{"allOf":[{"$ref":"#/$defs/RequestBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"unsubscribe"},"params":{"$ref":"#/$defs/UnsubscribeParams"}}}],"x-wukongim-product-status":"decoder-only-bridge-missing"},"RecvAckParams":{"type":"object","properties":{"header":{"$ref":"#/$defs/Header"},"messageId":{"type":"string"},"message_id":{"type":"string"},"messageSeq":{"type":"integer","format":"uint64","minimum":0},"message_seq":{"type":"integer","format":"uint64","minimum":0}}},"RecvAckNotification":{"allOf":[{"$ref":"#/$defs/NotificationBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"recvack"},"params":{"$ref":"#/$defs/RecvAckParams"}}}],"x-wukongim-product-status":"supported-on-authenticated-session-message-sequence-optional"},"ConnectResult":{"type":"object","properties":{"header":{"$ref":"#/$defs/Header"},"serverVersion":{"type":"integer"},"server_version":{"type":"integer"},"serverKey":{"type":"string"},"server_key":{"type":"string"},"salt":{"type":"string"},"timeDiff":{"type":"integer","format":"int64"},"time_diff":{"type":"integer","format":"int64"},"reasonCode":{"type":"integer"},"reason_code":{"type":"integer"},"nodeId":{"type":"integer","format":"uint64","minimum":0},"node_id":{"type":"integer","format":"uint64","minimum":0}}},"ConnectResponse":{"allOf":[{"$ref":"#/$defs/ResponseBase"},{"type":"object","required":["result"],"properties":{"result":{"$ref":"#/$defs/ConnectResult"}},"not":{"required":["error"]}}]},"SendResult":{"type":"object","properties":{"header":{"$ref":"#/$defs/Header"},"messageId":{"type":"string"},"message_id":{"type":"string"},"messageSeq":{"type":"integer","format":"uint64","minimum":0},"message_seq":{"type":"integer","format":"uint64","minimum":0},"reasonCode":{"type":"integer"},"reason_code":{"type":"integer"}}},"SendResponse":{"allOf":[{"$ref":"#/$defs/ResponseBase"},{"type":"object","required":["result"],"properties":{"result":{"$ref":"#/$defs/SendResult"}},"not":{"required":["error"]}}]},"PongResponse":{"allOf":[{"$ref":"#/$defs/ResponseBase"},{"type":"object","required":["result"],"properties":{"result":{"type":"null"}},"not":{"required":["error"]}}],"x-wukongim-product-status":"works"},"RecvParams":{"type":"object","required":["header"],"properties":{"header":{"$ref":"#/$defs/Header"},"setting":{"$ref":"#/$defs/Setting"},"msgKey":{"type":"string"},"expire":{"type":"integer","format":"uint32","minimum":0},"messageId":{"type":"string"},"messageSeq":{"type":"integer","format":"uint64","minimum":0},"clientMsgNo":{"type":"string"},"streamNo":{"type":"string"},"streamId":{"type":"string"},"streamFlag":{"type":"integer"},"timestamp":{"type":"integer","format":"int32"},"channelId":{"type":"string"},"channelType":{"type":"integer"},"topic":{"type":"string"},"fromUid":{"type":"string"},"payload":{"oneOf":[{"type":"object"},{"type":"string","contentEncoding":"base64"}]}}},"RecvNotification":{"allOf":[{"$ref":"#/$defs/NotificationBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"recv"},"params":{"$ref":"#/$defs/RecvParams"}}}]},"EventParams":{"type":"object","properties":{"header":{"$ref":"#/$defs/Header"},"id":{"type":"string"},"type":{"type":"string"},"timestamp":{"type":"integer","format":"int64"},"data":{"type":"string"}}},"EventNotification":{"allOf":[{"$ref":"#/$defs/NotificationBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"event"},"params":{"$ref":"#/$defs/EventParams"}}}]},"DisconnectNotification":{"allOf":[{"$ref":"#/$defs/NotificationBase"},{"type":"object","required":["params"],"properties":{"method":{"const":"disconnect"},"params":{"$ref":"#/$defs/DisconnectParams"}}}]},"ErrorResponse":{"allOf":[{"$ref":"#/$defs/ResponseBase"},{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/$defs/ErrorObject"}},"not":{"required":["result"]}}]},"GenericResponse":{"description":"The decoder returns GenericResponse for every response because the request method is not carried in the response object.","allOf":[{"$ref":"#/$defs/ResponseBase"},{"type":"object","properties":{"result":true,"error":{"oneOf":[{"$ref":"#/$defs/ErrorObject"},{"type":"null"}]}},"oneOf":[{"required":["result"],"not":{"required":["error"]}},{"required":["error"],"not":{"required":["result"]}}]}]}}}