Do you have any examples on how to use Sparkle HTTP server (http.sys) with Server Side Events (https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).
I've been experimenting without success and would appreciate any advise .
Initially just trying a simple scenario where Sparkle server module would simply send a timestamp every 1 seconds.
I'm using a sample for client side that just logs data (https://github.com/mdn/dom-examples/blob/master/server-sent-events/index.html using my url) and static serving it from same sparkle server.
So far have this though as mentioned it it's not working - ProcessRequest is reached and run ok but client is not showing any data and similarly browser debug tools do not show any data in the EventStream
procedure TServerSideEventsModule.ProcessRequest(const C: THttpServerContext);
C.Response.StatusCode := 200;
C.Response.Chunked := true;
C.Response.ContentType := 'text/event-stream';
Writer := TStreamWriter.Create(C.Response.Content, TEncoding.UTF8);
Writer.AutoFlush := true;
while not C.Response.Closed do
Writer.Write('data: ' + DateTimeToStr(now) + '\n\n');