A ThreadX-based WebSocket browser client for ASR 3605 that connects to cloud apps using WebSocket and streaming protocols. Designed for embedded RTOS environments with support for GitHub Codespaces and local Docker development.
┌─────────────────┐ WebSocket ┌─────────────────┐ WebSocket ┌─────────────────┐
│ Web Browser │◄──────────────────►│ Node.js │◄─────────────────►│ ASR 3605 │
│ (webapp/) │ Port 8080 │ Gateway │ Port 9000 │ ThreadX Client │
└─────────────────┘ │ (gateway/) │ │ (src/) │
└─────────────────┘ └─────────────────┘
- RFC6455 Compliant WebSocket Client - Full handshake validation, frame masking, text/binary support
- ThreadX + NetX Integration - Optimized for RTOS with minimal memory footprint
- TLS Support (WSS) - Optional NetX Secure + mbedTLS integration
- Node.js Gateway - Translates browser traffic to compact device protocol
- GitHub Codespaces Ready - Full dev environment with ARM toolchain
- Docker Support - Local development with docker-compose
- Click Code → Codespaces → Create codespace on main
- Wait for container to build (includes ARM toolchain + Node.js)
- Start the gateway:
cd gateway && npm install && npm start
- In a new terminal, build and run the emulator:
make host-sim ./build/threadx_browser_sim
- Open
webapp/index.htmlin the browser (use Codespaces port forward for 8080)
-
Clone the repository:
git clone https://github.com/SharksJio/ThreadXBrowser.git cd ThreadXBrowser -
Start the full stack:
docker-compose up --build
-
Open http://localhost:8080 for the web app
ThreadXBrowser/
├── .devcontainer/ # GitHub Codespaces configuration
│ ├── devcontainer.json
│ └── Dockerfile
├── src/ # ThreadX WebSocket client source
│ ├── main.c # Application entry point
│ ├── websocket_client.c # WebSocket implementation
│ ├── websocket_client.h
│ ├── threadx_netx_init.c # ThreadX/NetX initialization
│ ├── threadx_netx_init.h
│ └── platform_config.h # Platform-specific configuration
├── gateway/ # Node.js gateway server
│ ├── server.js
│ ├── package.json
│ └── Dockerfile
├── emulator/ # ThreadX emulator setup
│ ├── Dockerfile
│ └── run_emulator.sh
├── webapp/ # Browser test client
│ └── index.html
├── docs/ # Documentation
│ └── netx_wss_integration.md
├── docker-compose.yml # Local Docker stack
├── Makefile # Build system
└── README.md
make host-sim
./build/threadx_browser_simmake asr3605make cleanEdit src/platform_config.h to configure:
WS_SERVER_HOST- Gateway server IP/hostnameWS_SERVER_PORT- Gateway device port (default 9000)WS_USE_TLS- Enable/disable TLS (WSS)THREADX_STACK_SIZE- Thread stack sizesNETX_PACKET_POOL_SIZE- Network buffer pool size
The gateway uses a compact binary protocol for device communication:
Device Frame Format:
┌──────────────┬──────────┬─────────────────┐
│ Length (4B) │ Type (1B)│ Payload (var) │
│ Big-endian │ │ │
└──────────────┴──────────┴─────────────────┘
Types:
0x01 - JSON/Text message
0x02 - Binary data (audio/video chunks)
0x03 - Control command
0x04 - Ping/Pong
# Connect as browser client
npx wscat -c ws://localhost:8080
# Connect as device client (in another terminal)
npx wscat -c ws://localhost:9000make test- For Codespaces/Docker: Just a browser or Docker installed
- For local native build:
- ARM GCC toolchain (arm-none-eabi-gcc)
- ThreadX and NetX libraries
- mbedTLS (for TLS support)
MIT License - See LICENSE for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Azure RTOS (ThreadX, NetX, NetX Secure)
- mbedTLS for cryptographic functions
- ASR Microelectronics for ASR 3605 platform