Live
Live resource subscriptions
Native WebSocket. Send { op: "subscribe", id, resource, input } or { op: "unsubscribe", id }; receive { id, type: "ready" | "event" | "error" }.
GET
/
v1
/
live
TypeScript SDK
import Tembo from '@tembo-io/sdk';
const client = new Tembo();
const { ticket } = await client.live.authorize();
const connection = client.live.connect({ ticket });
try {
for await (const message of connection) {
if (message.type === 'ready' && message.id === undefined) {
connection.send({
op: 'subscribe',
id: 'events',
resource: 'sessions.events',
input: { scope: { sessionId: 'sessionId' } },
});
}
console.log(message);
}
} finally {
connection.close();
}curl --request GET \
--url https://api.tembo.io/v1/liveimport requests
url = "https://api.tembo.io/v1/live"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.tembo.io/v1/live', 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://api.tembo.io/v1/live",
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://api.tembo.io/v1/live"
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://api.tembo.io/v1/live")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tembo.io/v1/live")
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_bodyQuery Parameters
Minimum string length:
1Response
Authorized native WebSocket
Was this page helpful?
⌘I
TypeScript SDK
import Tembo from '@tembo-io/sdk';
const client = new Tembo();
const { ticket } = await client.live.authorize();
const connection = client.live.connect({ ticket });
try {
for await (const message of connection) {
if (message.type === 'ready' && message.id === undefined) {
connection.send({
op: 'subscribe',
id: 'events',
resource: 'sessions.events',
input: { scope: { sessionId: 'sessionId' } },
});
}
console.log(message);
}
} finally {
connection.close();
}curl --request GET \
--url https://api.tembo.io/v1/liveimport requests
url = "https://api.tembo.io/v1/live"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.tembo.io/v1/live', 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://api.tembo.io/v1/live",
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://api.tembo.io/v1/live"
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://api.tembo.io/v1/live")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tembo.io/v1/live")
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