SSE example

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!
Post Reply
dakosimo
Posts: 9
Joined: Sun Nov 27, 2016 8:24 am

SSE example

Post by dakosimo »

Is it possible to use Server-Sent-Events in Mod-harbour and Mercury ? How to define and use EventSource ?
I did not find any example in mod_harbour_samples.
On Internet there are samples for PHP, but I do not know how to realize it using Mercury. I made this view:

{{ View( 'head.view' ) }}
<body>
<h1>Testing SSE</h1>

<div id="result">

</div>

<script>
if(typeof(EventSource) !== "undefined") {
var source = new EventSource("servtime.prg");
source.onmessage = function(event) {
document.getElementById("result").innerHTML += event.data + "<br>";
};
} else {
document.getElementById("result").innerHTML = "Sorry, your browser does not support server-sent events...";
}
</script>

</body>
</html>

In servtime.prg I have:

FUNCTION Servtime()

LOCAL stime = TIME()
AP_RPuts( stime )

RETURN NIL

Servtime.prg I put in document root, in place where index.prg exists also.

On display I only get Testing SSE as header text, but no time.

Thank you and Best regards.

Dako.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: SSE example

Post by Antonio Linares »

Dako,

It is not implemented yet and it may work on the mod_harbour fastCGI version only

We are studying the way to implement it
regards, saludos

Antonio Linares
www.fivetechsoft.com
dakosimo
Posts: 9
Joined: Sun Nov 27, 2016 8:24 am

Re: SSE example

Post by dakosimo »

I will wait. It is not urgent.
Thank you.
Best regards.

Dako.
Post Reply