[Pas2js] pas2js and server sent events

Michael Van Canneyt michael at freepascal.org
Fri Aug 26 15:11:42 CEST 2022



On Fri, 26 Aug 2022, Luca Olivetti wrote:

> El 26/8/22 a les 13:58, Michael Van Canneyt ha escrit:
>> 
>> 
>> On Fri, 26 Aug 2022, Luca Olivetti wrote:
>> 
>>> El 26/8/22 a les 11:32, Michael Van Canneyt ha escrit:
>>> 
>>> 
>>>> I added the definition of EventSource class to the weborworker unit, so 
>>>> you
>>>> can work in a type-safe manner.
>>> 
>>> 
>>> Thank you.
>>> In case I go the websocket route I'll have to use a different server on a 
>>> different port than fpWeb, right?
>> 
>> No.
>> 
>> The HTTP implementation of FPC understands the upgrade request and will
>> switch to websocket, so you can use the same port.
>> 
>> You must use trunk for this, however.
>
> Mmmh, in case I don't want to use trunk, will the browser impose some 
> restriction to connect to a different port?

It can be that CORS interferes, but since it is GET only, I would think not.

In each case, you'll need trunk if you want websockets: 
websockets are only available in trunk.

Michael.


More information about the Pas2js mailing list