[Pas2js] pas2js and server sent events

Michael Van Canneyt michael at freepascal.org
Fri Aug 26 11:32:58 CEST 2022



On Fri, 26 Aug 2022, Luca Olivetti wrote:

> Hello,
>
> I see that pas2js has support for websockets, but I cannot find if it also 
> supports server sent events.
>
> A couple of years ago I implemented an application with sse where I used 
> fpWeb and plain html+javascript in the browser.
>
> Now I need to implement a more complex application and I'd like to use 
> pas2js, if it supports sse I can reuse the old server class, if it doesn't 
> I'll have to reimplement it as a websocket server.

If you could do it with Javascript, you are able to do it with pas2js.

I added the definition of EventSource class to the weborworker unit, so you
can work in a type-safe manner.

Michael.


More information about the Pas2js mailing list