BROWSE DOCUMENTATION
Documentation / Client WebSocket Guide

Client WebSocket Guide

Connect client to the program's WebSocket Server

Requirements

Before connecting, make sure:

  • The WebSocket server is enabled in the program
  • The program is running

Connection URL

The server runs locally using the format:

Text
ws://localhost:<port>

Python Example

Install the required library:

PowerShell
pip install websockets

Connection Example:

Python
import asyncio
import websockets
import json

URI = "ws://localhost:8765"

async def main():
    async with websockets.connect(URI) as ws:
        print("Connected to WebSocket server")

        await ws.send("Ping")

        response = await ws.recv()
        print("Ping ->", json.loads(response))

if __name__ == "__main__":
    asyncio.run(main())