This project demonstrates a lightweight AI camera streaming pattern using protobuf-encoded messages over WebSockets. A client simulates an edge device sending a camera frame, while a server decodes the frame and returns AI telemetry using a typed protobuf schema.
The solution is split into three key components:
The schema contains:
package.json – scripts and dependenciestsconfig.json – TypeScript compiler configproto/agent.proto – protobuf contract definitionproto/agent.ts – generated TypeScript bindingserver/index.ts – AI server logicclient/index.ts – client simulationFresh verification was completed successfully.
$ pnpm --dir /home/ashan/Documents/GitHub/protobuf-projects/agent-protobuf-stream run check $ tsc --noEmit -p tsconfig.json $ PORT=8082 pnpm --dir /home/ashan/Documents/GitHub/protobuf-projects/agent-protobuf-stream start:client 📷 Camera stream connected. Emitting frames every 1000ms... [LATENCY: 4ms] MONITORING -> vehicle(0.90) [LATENCY: 0ms] TRACKING_ACTIVE -> bicycle(0.91), traffic_cone(0.81) [LATENCY: 0ms] ALERT -> bicycle(0.95), traffic_cone(0.85), person(0.75)
This confirms the project compiles and the protobuf WebSocket communication is working in a live environment.
cd /home/ashan/Documents/GitHub/protobuf-projects/agent-protobuf-stream PORT=8082 pnpm start:server PORT=8082 pnpm start:client
If the port is already occupied, use another free port such as PORT=8083 on both commands.
The project is a clean proof of concept for an edge-device-to-AI service that uses protobuf serialization over WebSockets. It is functional, testable, and suitable as a foundation for a larger real-time vision or telemetry system.