Skip to Content

WebSocket V2 Quick Start Guide

Current: V2 · Beta: V3 — V2 is the recommended protocol for new production integrations. V3 is available in closed beta.

Get up and running with the V2 WebSocket API in minutes with this simple Hello World example.

Prerequisites

  • A WebSocket client (browser, Node.js, or any WebSocket-capable environment)
  • Access to wss://ai.api.production.signapsesolutions.com

Hello World

Select a language in the code panel to see the complete example. Each example connects, sends a “Hello World” translation request, and handles the response.


Understanding the Message

The V2 message has a structured format with four required sections:

  • protocol — Identifies your client and version for compatibility

    • name: Your application name (e.g. “my-app”)
    • version: Protocol version (use “2.0”)
  • content — The input to translate

    • type: Currently only “text” is supported
    • data: The text to translate
  • output — How you want the video delivered

    • format: "hls" (streaming) or "mp4" (file)
    • delivery.method: "stream" (for HLS) or "download" (for MP4)
  • context — Application context for routing

    • application: Your application type (e.g. “media”)

Format Recommendations

  • HLS + stream: Best for live/real-time scenarios
  • MP4 + download: Best for on-demand content and downloads

Common Issues

ProblemSolution
No responseCheck that all required fields are present
"success": falseRead the message field for error details
Invalid format errorVerify JSON structure matches schema exactly

V2 vs V1

V2 Advantages:

  • Structured, future-proof format
  • Explicit protocol versioning
  • Better extensibility
  • Typed content objects

When to use V1:

  • You’re maintaining legacy code

Request
// Install: npm install ws
const WebSocket = require('ws');

const ws = new WebSocket('wss://ai.api.production.signapsesolutions.com');

ws.on('open', () => {
    console.log('Connected!');

    const message = {
        protocol: {
            name: "my-app",
            version: "2.0"
        },
        content: {
            type: "text",
            data: "Hello World"
        },
        output: {
            format: "hls",
            delivery: {
                method: "stream"
            }
        },
        context: {
            application: "media"
        }
    };

    ws.send(JSON.stringify(message));
    console.log('Sent: Hello World');
});

ws.on('message', (data) => {
    const response = JSON.parse(data);
    if (response.success) {
        console.log('Success:', response.message);
    } else {
        console.log('Error:', response.message);
    }
});

ws.on('error', (error) => {
    console.error('WebSocket Error:', error);
});

ws.on('close', () => {
    console.log('Connection closed');
});
Response
{
  "protocol": {
    "name": "signapse-client",
    "version": "2.0"
  },
  "success": true,
  "message": "Video processing for Hello World"
}
Last updated on
Question? Give us feedback
support@signapse.ai