This guide is for Windows users who want low-latency, real-time control of their robot through Wi-Fi.
By using WebSocket, your PC and the robot driver board can exchange data in both directions instantly β without the delay or polling limitations of traditional HTTP requests.
π¦ GitHub Repository:
https://github.com/EffectsMachine/robot_driver_with_esp32s3_lite
WebSocket is a full-duplex protocol built on TCP, allowing persistent, two-way communication between your computer (host) and the robot (device).
Itβs ideal for robotics applications that require continuous state updates and fast command response β typically up to 60 messages per second.
| Feature | Description |
|---|---|
| β Low latency & persistent connection | The connection is established once, avoiding repeated handshakes like HTTP. Response latency can reach the millisecond level β perfect for motion control. |
| β True bidirectional data flow | Both sides can actively send data β commands from the PC and status feedback from the robot β with no need for polling. |
| β Wide compatibility | Uses the same ports as HTTP (80/ws, 443/wss), bypasses most firewalls, and is supported in all major languages (Python, JavaScript, etc.). |
| β οΈ Requires connection management | Youβll need to handle reconnection if Wi-Fi drops β unlike HTTPβs one-shot model. |
| β οΈ Slightly harder to debug | Standard browsers canβt test it directly; use tools like Postman (WebSocket mode) or scripts instead. |
The ESP32-based driver board runs a lightweight WebSocket server that shares the same port (80) as HTTP, with the fixed endpoint /ws.
Once powered on, the board automatically starts the WebSocket service.
All commands use the same JSON format as HTTP, for example:
{"T":202,"line":1,"text":"webSocket msg","update":1}