I used this build of httpuv with Shiny, both locally and deployed over Hugging Face Spaces, using Wireshark to make sure that Ping packets were being sent at the correct intervals.
In the browser on another machine, I navigated to about:blank and typed this code into the JS console:
var ws = new WebSocket("ws://<HOSTNAME>:8101");
ws.onmessage = (msg) => {
if (!/^j+$/.test(msg.data)) {
console.log("bad");
} else {
console.log("good");
}
ws.send("");
};
What this does is repeatedly send large (1MB) messages from server to client, way too big to fit in a single TCP packet. I wanted to ensure that the Ping packets being sent at random times wouldn't get in between packets belonging to a message. The test worked; even hacking the httpuv source code to send Ping every 10 milliseconds didn't pose a problem.
Manual testing performed
I used this build of httpuv with Shiny, both locally and deployed over Hugging Face Spaces, using Wireshark to make sure that Ping packets were being sent at the correct intervals.
I also used this torture test app:
In the browser on another machine, I navigated to
about:blank
and typed this code into the JS console:What this does is repeatedly send large (1MB) messages from server to client, way too big to fit in a single TCP packet. I wanted to ensure that the Ping packets being sent at random times wouldn't get in between packets belonging to a message. The test worked; even hacking the httpuv source code to send Ping every 10 milliseconds didn't pose a problem.