Push with webSdk


It is possible to send a message to the browser with the webSdk?
In framework.js, I not find the event.

thank you

You don’t have to do that. Any change made to any control which is not in response to a user action will be pushed to the browser.

Thank you Greg.

For handleSpecialUrl, I tried Server-Sent Events (I can impose browser choice to my customers).

It’s simple and effective, it automatically reconnects in case of errors, it can handle various events, that sounds really strong. Above all, it is always based on the http protocol, so this is a solution waiting websocket…

But as Xojo (handleSpecialUrl) appears automatically close the connection for every request, I lose the advantage of persistent connection. It is possible to keep open the connection for several tens of seconds?

Actually, I misspoke. In handleSpecialUrl, I retain the connection until I have data to send. SSE then automatically reconnects. it works well. But each handleSpecialUrl response, the browser receives an error. So automatically, SSE closes and opens a new request for each answer. Returning to the starting point. I seek the reason for this error. Apparently, SSE does not detail the type of error.

um, I think it’s because we can not keep the connection open in handleSpecialUrl when we return a response and “True”.

I guess it’s because the handleSpecialUrl thread is killed.

Right. HandleSpecialURL and HandleURL don’t allow you to hold open a connection. They are purely Parse, Respond, Close mechanism which is good for API calls, and retrieving assets, not for creating new connection mechanisms.

If you truly want to use server events, you’re probably going to need to add another instance of ServerSocket and create your own server for handling these things.

It really is because the socket is closed.