Welcome! Log In Create A New Profile


server side events

Posted by Allard 
server side events
January 03, 2020 09:04AM
Hello ,

I saw something in the help on this but no code what so ever. This is a feature of webdevelopment since 2006!!

Ok Has anyone ever used this with webdev?

I Need to add some servercode in phpo it would be like this

header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');

$time = date('r');
echo "data: The server time is: {$time}\n\n";

The javascript to get the page changes would be like this

var source = new EventSource("PAGE_Onderhoiud.php");
source.onmessage = function(event) {
document.getElementById("result").innerHTML += event.data + "<br>";

There is no framework or anything used . This is it. SSE is great . A lot less overhead then witch websockets as that is a whole different protocol

Adding the phpo and the javascript does not work!! ( at least if I try it ) . The code runs without webdev like a charm

Re: server side events
February 18, 2020 09:05AM
update ,

This kinfd of works with dynamic webdev sites . You can put a check on the page to run serverside code x times per second


Renko Allard


If you work with awp pages you are left inthe dark. ==> 20 times less fast then. The framework is then defenately working against you

Your Email:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.