I stumbled upon a rather strange site the other day : https://harmless.herokuapp.com/main
It is an online mini chat that does not use javascript on the client side, and yet it allows you to display your messages and those of others, in real time.
While trying to document myself I came across the term "Long Polling" but all the sources I could look at used javascript to implement it.
I guess the forever loading page is something to do with it. From what I understand, if a valid XMLHttpRequest is not returned, then the client-side browser never closes the connection with the server and keeps trying to receive data. I tried the code below but it didn't work : How do I implement basic "Long Polling"?
<?php
if(rand(1,3) == 1){
/* Fake an error */
header("HTTP/1.0 404 Not Found");
die();
}
/* Send a string after a random number of seconds (2-10) */
sleep(rand(2,10));
echo("Hi! Have a random number: " . rand(1,10));
?>
In short, I wanted to understand how a site could update the data received and send it back to the user in real time without using client-side javascript.
EDIT :
Here is the answer : github.com/kkuchta/css-only-chat
Thank you to Flux for his find!