This document aims to create the JsonRpc contract between a client and a server.
The following definitions are shared concepts across all JSON-RPC methods for the Iridium API:
- topic - a target topic for the message to be subscribed by the receiver.
- message - a plaintext message to be relayed to any subscribers on the topic.
- ttl - a storage duration for the message to be cached server-side in seconds (aka time-to-live).
- tag - a label that identifies what type of message is sent based on the rpc method used.
- prompt - a flag that identifies whether the server should trigger a notification webhook to a client through a push server.
- id - a unique identifier for each subscription targetting a topic.
Used when a client publishes a message to a server.
{
"id" : "1",
"jsonrpc": "2.0",
"method": "iridium_publish",
"params" : {
"topic" : string,
"message" : string,
"ttl" : seconds,
"tag" : number, // optional / default = 0
"prompt" : boolean, // optional / default = false
}
}
Used when a client subscribes a given topic.
{
"id" : "1",
"jsonrpc": "2.0",
"method": "iridium_subscribe",
"params" : {
"topic" : string
}
}
Used when a client unsubscribes a given topic.
{
"id" : "1",
"jsonrpc": "2.0",
"method": "iridium_unsubscribe",
"params" : {
"topic" : string,
"id": string
}
}
Used when a server sends a subscription message to a client.
{
"id" : "1",
"jsonrpc": "2.0",
"method": "iridium_subscription",
"params" : {
"id" : string,
"data" : {
"topic" : string,
"message": string
}
}
}
- What is a client? - Any SDK instance (Sign, Chat, Auth, Push)