This demo reads from a WebSocket stream of Wikipedia Recent Changes and, after a fake processing step that takes one second, echos the result back to another WebSocket server.
Open the DevTools of your browser to see the in- and outgoing WebSocket traffic. On Chrome, you can filter the Network tab to just show WebSocket data.
This part of the demo reads from a WebSocketStream
of recent Wikipedia changes
and writes each message back to a different echo WebSocketStream
.
✅ Backpressure is applied to both read and write operations. The next message is only read once the pipeline is ready.
This part of the demo reads from a regular WebSocket
of recent Wikipedia changes
and writes each message back to a different echo WebSocket
.
❌ No backpressure is applied. In the worst case, the render process will either fill up memory by buffering those messages, become unresponsive due to 100% CPU usage, or both.