IPC Messages
Send data both ways between the browser and a program on the device: AI events, sensor values, or remote-control commands. pi-webrtc passes the messages between a WebRTC DataChannel and a Unix socket on the device.
This works with --use-mqtt and --use-livekit.
Two channels
With --enable-ipc, pi-webrtc opens two extra channels:
| Channel | Use it for |
|---|---|
| Lossy | Messages where old data can be dropped, such as live sensor values |
| Reliable | Messages that must arrive, such as commands |
The client chooses the channel for each message. client-sdk-js uses the reliable channel by default.
Note
With --use-livekit, messages go to everyone in the room.
Try it
-
Start pi-webrtc with
--enable-ipc:./pi-webrtc --camera=libcamera:0 ... --use-mqtt ... --enable-ipc -
On the device, run the unix_socket_client.py example. It prints every message that goes through pi-webrtc:
python3 examples/unix_socket_client.py -
In the browser, use
onMessage()to receive messages, andsendText()orsendData()to send them.
- Code example: Send and receive IPC messages
- Web app: app.mazupo.com/interaction
The Unix socket is /tmp/pi-webrtc-ipc.sock by default. Change it with --socket-path.
Integrations
Connect pi-webrtc to your own software. Send messages both ways, read a gamepad, show the camera in Home Assistant, or stream from a ROS robot.
Gamepad
Control the device with a gamepad that is connected to the browser. pi-webrtc sends the gamepad state to a Unix socket on the device, as simple JSON lines. Y...

