Upgrade to WebSocket for real-time streaming
curl --request GET \
--url http://{device-ip}:{device-port}/audio-analytics/v1/api/streamimport requests
url = "http://{device-ip}:{device-port}/audio-analytics/v1/api/stream"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://{device-ip}:{device-port}/audio-analytics/v1/api/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://{device-ip}:{device-port}/audio-analytics/v1/api/stream",
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 := "http://{device-ip}:{device-port}/audio-analytics/v1/api/stream"
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("http://{device-ip}:{device-port}/audio-analytics/v1/api/stream")
.asString();require 'uri'
require 'net/http'
url = URI("http://{device-ip}:{device-port}/audio-analytics/v1/api/stream")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"error": {
"message": "Invalid request, missing 'file' parameter",
"type": "invalid_request_error",
"param": "file",
"code": null
}
}{
"error": {
"message": "Invalid request, missing 'file' parameter",
"type": "invalid_request_error",
"param": "file",
"code": null
}
}Upgrade to WebSocket for real-time streaming
Upgrades the HTTP connection to a WebSocket for real-time audio streaming.
Usage
- Create a transcription session with
stream=true - Connect to this WebSocket endpoint
- Send audio chunks as JSON messages
- Receive transcription results in real-time
Client → Server (Audio Chunks)
{
"message_type": "transcriptions_session_audio",
"message_source": "audio_analytics_api",
"session_id": "session123",
"type": "input_audio",
"data": "<BASE64_ENCODED_AUDIO>"
}
Server → Client (Event Sequence per Utterance)
1. Speech detected:
{ "session_id": "session123", "type": "transcript.event", "state": "speech_start" }
2. Partial transcription (zero or more):
{ "session_id": "session123", "text": "Partial transcription text", "language": "en", "type": "transcript.text.delta", "state": "transcription" }
3. End of speech detected:
{ "session_id": "session123", "type": "transcript.event", "state": "speech_end" }
4. Final transcription:
{ "session_id": "session123", "text": "Complete transcription text.", "language": "en", "type": "transcript.text.done", "state": "transcription" }
After step 4 the engine resets and listens for the next utterance.
The session stays open until the client calls /transcriptions/close.
Connection
- Protocol: WebSocket (ws:// or wss://)
- URL:
ws://<host>:8085/stream - Requires prior session creation via
/transcriptions/create
GET
/
stream
Upgrade to WebSocket for real-time streaming
curl --request GET \
--url http://{device-ip}:{device-port}/audio-analytics/v1/api/streamimport requests
url = "http://{device-ip}:{device-port}/audio-analytics/v1/api/stream"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://{device-ip}:{device-port}/audio-analytics/v1/api/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://{device-ip}:{device-port}/audio-analytics/v1/api/stream",
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 := "http://{device-ip}:{device-port}/audio-analytics/v1/api/stream"
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("http://{device-ip}:{device-port}/audio-analytics/v1/api/stream")
.asString();require 'uri'
require 'net/http'
url = URI("http://{device-ip}:{device-port}/audio-analytics/v1/api/stream")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"error": {
"message": "Invalid request, missing 'file' parameter",
"type": "invalid_request_error",
"param": "file",
"code": null
}
}{
"error": {
"message": "Invalid request, missing 'file' parameter",
"type": "invalid_request_error",
"param": "file",
"code": null
}
}Response
Switching Protocols - WebSocket connection established
Was this page helpful?

