Exec
Run a command over a WebSocket
Runs a command over a WebSocket, streaming output back and accepting stdin over one connection.
Connect with two Sec-WebSocket-Protocol values: superserve.exec.v1
and token.<access-token>.
I/O rides binary frames prefixed with a one-byte channel, so output is byte-exact; lifecycle and control ride text JSON frames.
- First frame (text): an
ExecRequestJSON object. Omittingtimeout_sruns with no per-command timeout. - Client frames: a binary frame is stdin, prefixed with channel
0x00([0x00][bytes]); a text frame is JSON control —{"type":"stdin_close"}or{"type":"signal","name":"SIGINT"}. Client frames are capped at 4 MiB (servers may enforce as low as 64 KiB during rollout); frames over the cap close the socket with code 1009, so chunk larger stdin. - Server frames: a binary frame is output, prefixed with its channel
(
0x01stdout,0x02stderr); a text frame is JSON lifecycle —{"exit_code":N,"finished":true}, or{"error":"...","code":"..."}. Closes on exit.
GET
/
exec
/
connect
Run a command over a WebSocket
curl --request GET \
--url https://sandbox.superserve.ai/exec/connectimport requests
url = "https://sandbox.superserve.ai/exec/connect"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://sandbox.superserve.ai/exec/connect', 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.superserve.ai/exec/connect",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.superserve.ai/exec/connect"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.superserve.ai/exec/connect")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.superserve.ai/exec/connect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyResponse
101
Switching Protocols — the WebSocket is established.
⌘I
Run a command over a WebSocket
curl --request GET \
--url https://sandbox.superserve.ai/exec/connectimport requests
url = "https://sandbox.superserve.ai/exec/connect"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://sandbox.superserve.ai/exec/connect', 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.superserve.ai/exec/connect",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.superserve.ai/exec/connect"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.superserve.ai/exec/connect")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.superserve.ai/exec/connect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body