--- license: mit tags: - websocket - real-time - streaming - python --- # awoo.cf WebSocket Client Python client and reverse-engineered protocol toolkit for the `awoo.cf` / `nekohash` real-time imageboard engine. ## Architecture & Handshake Details 1. **Cloudflare clearance & WASM fingerprinting:** - Active session cookies extracted directly from Firefox (`~/.mozilla/firefox/*.default`): `cf_clearance`, `__cf_bm`, `mgc_fpc`, `meta_pass`, `captcha_session`, `_known`. 2. **Token Binding (`POST https://p.awoo.cf/v1/token`):** - Direct connection to `p.awoo.cf` backend, registering a 32-byte `binding` parameter. 3. **WebSocket Upgrade (`wss://p.awoo.cf/api/socket?binding=`):** - Headers: `Origin: https://awoo.cf`, `Cookie: `. 4. **WebSocket 6-Step Challenge Handshake:** - Upon connection, the server sends an integer challenge `t` (`100000 <= t <= 1999999`). - The client replies with `t + 1`. - After 6 rounds of ping-pong challenges, the server sends the confirmed token string (`v2.`). 5. **Dual-Mode Protocol Framing:** - **ASCII/JSON Control Framing:** `<2-digit-opcode>` for synchronization (`44`), presence (`49`), NekoTV (`54`), and Arcade (`80`). - **Little-Endian Binary Framing:** `<8-byte float64 post_id><1-byte opcode>` for real-time keystroke streaming (`02`, `03`, `04`) and live AI token generation (Claude Thinking `81`, Claude `11-13`, Imagen `14-16`, Video `17-34`, Venice `64-66`, Atlas `67-69`, BytePlus `82-84`). 6. **Keepalive:** - Message type `48` serves as periodic NOOP ping. ## Verified Capabilities - ✅ Full end-to-end handshake and authentication - ✅ Multi-instance connection support: **30 simultaneous WebSocket instances** held open and synchronized - ✅ Live thread and post streaming with binary frame decoding - ✅ Complete reverse-engineered protocol documentation: see [docs/NEKOHASH.md](docs/NEKOHASH.md) and [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) - ✅ Arcade multiplayer protocol (19+ in-thread games) and NekoTV watch-party specification - ✅ Instant client-side SHA-1 media deduplication pipeline (`/api/upload-hash`) ## Usage ### Installation ```bash pip install -r requirements.txt ``` ### 1. Single Client Demo ```bash python3 awoo_client.py ``` ### 2. Live Thread Synchronization & Streaming ```bash # Sync to a specific thread and stream live posts / typing events python3 sync_thread.py --board g --thread 1256858 ``` ### 3. Run Concurrent Connections ```bash # Hold open 30 concurrent connections python3 multi_connect.py -n 30 -b all # Or run 5 connections for 300 seconds python3 multi_connect.py -n 5 -d 300 ```