WebSocket quick start
Connect
Section titled “Connect”Use the endpoint below, replacing the client name with your application name:
ws://127.0.0.1:42070/?client=YourAppThe client query parameter is required. URL-encode names containing spaces or special characters.
Send an envelope
Section titled “Send an envelope”Send a text message with command SendNotification. jsonData must be a JSON-encoded string, not a nested object.
{ "sender": "YourApp", "target": "XSOverlay", "command": "SendNotification", "jsonData": "{\"title\":\"Hello from YourApp\",\"content\":\"Your first notification.\",\"sourceApp\":\"YourApp\"}"}The current implementation reads command and jsonData; it does not route notifications using sender or target. Other commands are ignored. A successful send is not a delivery acknowledgement.
Python example
Section titled “Python example”Install the client library:
python -m pip install websocket-clientimport jsonfrom websocket import create_connection
payload = { "title": "Build complete", "content": "Your project is ready.", "sourceApp": "BuildHelper", "timeout": 5.0,}message = { "sender": "BuildHelper", "target": "XSOverlay", "command": "SendNotification", "jsonData": json.dumps(payload),}with create_connection("ws://127.0.0.1:42070/?client=BuildHelper") as connection: connection.send(json.dumps(message))C# example
Section titled “C# example”For a modern .NET console application:
using System;using System.Net.WebSockets;using System.Text;using System.Text.Json;using System.Threading;
using var socket = new ClientWebSocket();using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(5));await socket.ConnectAsync( new Uri("ws://127.0.0.1:42070/?client=BuildHelper"), timeout.Token);
var payload = new { title = "Build complete", content = "Your project is ready.", sourceApp = "BuildHelper", timeout = 5.0};var envelope = new { sender = "BuildHelper", target = "XSOverlay", command = "SendNotification", jsonData = JsonSerializer.Serialize(payload)};var bytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(envelope));await socket.SendAsync( new ArraySegment<byte>(bytes), WebSocketMessageType.Text, true, timeout.Token);This sample disconnects when it finishes. A longer-running integration can reuse its connection and should reconnect after connection failures.
See the payload reference and compatibility limits.
