API Methods
api method
get_envoy_token
request
"Params":{
"reusable_minutes":60,
"Task":{
"task_context":"c549-4375-9b27-142e2ff2c031",
"send_offline_message":true,
"timeout":10,
"single_instance":true,
"persist_timeout": false,
}
}
response
{
"id": "2",
"jsonrpc": "2.0",
"error": null,
"result": {
"client_token": "qSm36UluBDm7RuwR/K2XazDMeidT....",
"task_id": "67da434f80ecb38733148bc5fab530e9c134b4adab4...."
}
}
task_context
Any data to associate with the client token. Example, a hash of client
data/request will consistently return the same task_id if such data is
unchanged. In any case, this method will always return a unique
client_token.
send_offline_message
Whether to send your most recent message whenever clients start a new
connection for associated task. Example, useful to ensure that last message
is communicated if client reloads page.
timeout
Your client web-socket will stay open until you send a response, timeout
sets the number of minutes to close the connection if no message is
supplied.
single_instance
Whether a previous client connection for specified task_info should be
terminated whenever a new connection is initiated for such task. Default is
false.
persist_timeout
Whether a previous client connection for specified task_info should be
terminated whenever a new connection is initiated for such task. Default is
false.
reusable_minutes
Number of minutes before the client token expires, making the token invalid
for new connections only.
api method
invoke_envoy
request
"Params":{
"task_id":"67da434f80ecb38733148bc5...",
"message":"aGVsbG8=",
"new_timeout":20,
}
response
{
"id": "2",
"jsonrpc": "2.0",
"error": null,
"result": {
"status":"success"
}
}
task_id
Send message to all clients for the task_id previously obtained with
get_envoy_token method.
message
Your base64 encoded object
new_timeout
If greater than zero, client web socket will remain open allowing additional
messages for said time. Example, handle under-payments with ongoing
messages/updates until fully paid.