Re: Asynchronous update from web server
Esteban Maringolo <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <CAJMgPCJLsgu6Fa_To28qAOz8FdA3PvOhO7PX+68sr46Zca2fdA@mail.gmail.com> |
I implemented a mix of WebSockets with standard JS AJAX requests, where I had a WS sending a message to the client which then triggered a regular AJAX request to the seaside server. In the end I discarded the WS and moved to a recursive setTimeout() interval approach [1], because the screen that was updated "live" didn't require more than an update per minute (it was a live map) and most times the user moved on and off from that component faster than that. The reason to discard it was that the WS server was running in a different port than the Seaside Server, and the setup of that wasn't optimal for my taste. So it was more a proof of concept (which worked just fine) than a recommended pattern. And then the question is... what kind of update you want to "push" to the client? [1] setTimeout() is "better" than setInterval() because the call will happen 60 seconds (or any duration) __after__ the last execution, this is better for some use cases and in particular if you're debugging something and it takes you more than the defined interval to send a response to the client. Esteban A. Maringolo El sáb., 6 abr. 2019 a las 11:07, [email protected] (<[email protected]>) escribió: > > Thanks Cyril. > > > > On Sat 6 Apr 2019 at 15:56, [email protected] <[email protected]> wrote: >> >> Ciao, >> >> I have a Seaside application. >> >> I do not know the technical terms of my request ( sorry ). >> >> I ask if it is possible to update a web client asynchronously directly from the server. >> >> For now i manage the update from the client with the jquery load and relative interval: 10 seconds > > > Hello, > > There is multiple way to do that. > > The first I know is, like you said, to make the client request the server from time to time. > > The second is to use WebSockets (in Pharo there is an implementation in a special group of the Zinc project). WebSockets allows bi-directional communication between client and server. > > > Any reference, example about it? > > It's support , replicate into Gemstone environment? > > > The third one is Commet project I think but I never used it. I just know it exists. > > The cleaner and most used of the three is WebSockets I think. > > > Thanks, > Dario > _______________________________________________ > seaside mailing list > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [email protected] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside