curl --request PUT \
--url https://sandbox.circularo.com/api/v1/ws/{token} \
--header 'Content-Type: application/json' \
--data '
{
"message": {
"type": "signature",
"data": "data:image/png;base64,iVBORw0KGgo..."
}
}
'import requests
url = "https://sandbox.circularo.com/api/v1/ws/{token}"
payload = { "message": {
"type": "signature",
"data": "data:image/png;base64,iVBORw0KGgo..."
} }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({message: {type: 'signature', data: 'data:image/png;base64,iVBORw0KGgo...'}})
};
fetch('https://sandbox.circularo.com/api/v1/ws/{token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.circularo.com/api/v1/ws/{token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'message' => [
'type' => 'signature',
'data' => 'data:image/png;base64,iVBORw0KGgo...'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.circularo.com/api/v1/ws/{token}"
payload := strings.NewReader("{\n \"message\": {\n \"type\": \"signature\",\n \"data\": \"data:image/png;base64,iVBORw0KGgo...\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://sandbox.circularo.com/api/v1/ws/{token}")
.header("Content-Type", "application/json")
.body("{\n \"message\": {\n \"type\": \"signature\",\n \"data\": \"data:image/png;base64,iVBORw0KGgo...\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.circularo.com/api/v1/ws/{token}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": {\n \"type\": \"signature\",\n \"data\": \"data:image/png;base64,iVBORw0KGgo...\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS"
}{
"status": 400,
"type": "VALIDATION:INPUT_INVALID",
"message": "Invalid input",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}{
"status": 404,
"type": "RESOURCE:NOT_FOUND",
"message": "Resource not found",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}Send a message into a WebSocket connection
PUT /ws/{token}
Delivers a message to the client on the other end of an open WebSocket connection. This is what lets a second device reach a session already running somewhere else: a browser opens the socket and shows its token to a phone, and whatever the phone sends here - a photograph, a signature drawn on the screen, a file picked on the device - arrives in the browser that is waiting for it.
Whoever holds the token may send, and that is deliberate: the device sending on the user’s behalf is not signed in, so the token of the connection is the whole of the authorization. It is worth as much as the session it belongs to and is meant for that one exchange.
Which instance of the platform the request lands on does not matter - the message is offered to all of them and delivered by the one actually holding that connection. The answer says whether it went out: the platform waits briefly for that instance to confirm it wrote the message to the socket, and reports a failure rather than keeping it for a client that is not there. Nothing is queued and nothing is retried.
No authorization: No authorization is required to call this endpoint.
curl --request PUT \
--url https://sandbox.circularo.com/api/v1/ws/{token} \
--header 'Content-Type: application/json' \
--data '
{
"message": {
"type": "signature",
"data": "data:image/png;base64,iVBORw0KGgo..."
}
}
'import requests
url = "https://sandbox.circularo.com/api/v1/ws/{token}"
payload = { "message": {
"type": "signature",
"data": "data:image/png;base64,iVBORw0KGgo..."
} }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({message: {type: 'signature', data: 'data:image/png;base64,iVBORw0KGgo...'}})
};
fetch('https://sandbox.circularo.com/api/v1/ws/{token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.circularo.com/api/v1/ws/{token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'message' => [
'type' => 'signature',
'data' => 'data:image/png;base64,iVBORw0KGgo...'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.circularo.com/api/v1/ws/{token}"
payload := strings.NewReader("{\n \"message\": {\n \"type\": \"signature\",\n \"data\": \"data:image/png;base64,iVBORw0KGgo...\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://sandbox.circularo.com/api/v1/ws/{token}")
.header("Content-Type", "application/json")
.body("{\n \"message\": {\n \"type\": \"signature\",\n \"data\": \"data:image/png;base64,iVBORw0KGgo...\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.circularo.com/api/v1/ws/{token}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": {\n \"type\": \"signature\",\n \"data\": \"data:image/png;base64,iVBORw0KGgo...\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS"
}{
"status": 400,
"type": "VALIDATION:INPUT_INVALID",
"message": "Invalid input",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}{
"status": 404,
"type": "RESOURCE:NOT_FOUND",
"message": "Resource not found",
"requestId": "3fa85f6457174562b3fc2c963f66afa6"
}Path Parameters
Body
What is to be delivered. It is passed to the client exactly as it arrives and the platform reads nothing out of it; by convention clients send an object naming the kind of message and the data belonging to it.
{
"type": "signature",
"data": "data:image/png;base64,iVBORw0KGgo..."
}