[Seaside] Asynchronous update from web server

dtrussardi at tiscali.it dtrussardi at tiscali.it
Mon Apr 8 10:48:17 UTC 2019


Ciao,

> 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?

	In my case i haven't any user actions on the client.

	The client display some data with dynamic banner ( marquee tag )

	and i need to update it only when the data to display change from the server.

	When the data on the server relative to an banner change i need to force the clients banners update.

	it seems to me that your initial solution may be fine.

	What do you think?

	Another solution could be to manage an client ajax request with a specific interval  

	but  update the relative  banner div  only if the related data received from the server changed.

		( But how i can manage it?

		 Can i not reply to an client ajax request 
		
			or respond to doing nothing and continue to view the current status )

	Thanks,

	Dario

> 
> [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, dtrussardi at tiscali.it
> (<dtrussardi at tiscali.it>) escribió:
>> 
>> Thanks  Cyril.
>> 
>> 
>> 
>> On Sat 6 Apr 2019 at 15:56, dtrussardi at tiscali.it <dtrussardi at tiscali.it> 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
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list