Dynamically updating a WEB page

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamically updating a WEB page

Roland Hochmuth
Hi, Does Seaside have any provisions for dynamically updating a WEB  
page without the user initiating a callback action? For example, if  
the WEB page is just displaying a clock that was suppose to  
automatically update every minute how can it be updated without a  
user action? What I've done so far is create a callback action  
attached to the image of the clock. If the user clicks on the image  
the callback just invokes #answer which returns to the  
ClockController, which is a WATask. ClockController then just creates  
a new ClockDisplay, which is a WAComponent, and  then invokes #call  
on it. What I would like to do is have the ClockController  
periodically invoke a method "update" in ClockDisplay which would  
force a new WEB page being displayed for the user. Is this where I  
need to write javascript?

Regards --Roland
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

cbeler


Roland Hochmuth a écrit :

> Hi, Does Seaside have any provisions for dynamically updating a WEB  
> page without the user initiating a callback action? For example, if  
> the WEB page is just displaying a clock that was suppose to  
> automatically update every minute how can it be updated without a  
> user action? What I've done so far is create a callback action  
> attached to the image of the clock.

It's a live action. You can do that in several way

install scriptaculous
Have a look at scriptaculous examples... there are code samples

http://scriptaculous.seasidehosting.st

install seaside Async    your choice :)
a demo is here
http://cdrick.seasidehosting.st/seaside/LiveTests

see you

Cédrick

--------------------------------
L'ENIT vous invite a sa journee portes ouvertes le 17 mars 2006 de 13h30 a 19h30

Enit , 47 avenue d'Azereix 65000 Tarbes
 Bus N°1, arret ENI

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

Lukas Renggli
> Is this where I need to write javascript?

You don't have to write JavaScript, let Seaside do it for you:

Clock>>renderContentOn: html
   html paragraph
      script: (html periodical
         frequency: 60
         on: [ :r | r render: Time now ])

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

Lukas Renggli
> Clock>>renderContentOn: html
>    html paragraph
>       script: (html periodical
>          frequency: 60
>          on: [ :r | r render: Time now ])

Oups, this should rather be:

    html paragraph
       script: (html periodical
          frequency: 60;
          callback: [ :r | r render: Time now ])

Sorry,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

Brad Fuller
Lukas Renggli wrote:
>>
>>     html paragraph
>>        script: (html periodical
>>           frequency: 60;
>>           callback: [ :r | r render: Time now ])
>>
>>    
does anyone know the latency range of this type of update? If you are
using the clock on the backend, and updating the image on the client,
then there would be  an unknown latency here -- or is it unknown? Maybe
there is a "probable" range that can be counted on?

Here's another related question. Say I want to send an audio stream to a
client and at some point the user clicks a button to switch to a
different stream. There will be latency that is the sum of the latency
of all the hops (and server and client latency, which would be much
smaller) that the user request path takes and then the latency of the
new stream. Can this be determined dynamically?  Is there a rule of
thumb for a range, or worst case?

brad
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

Roland Hochmuth
In reply to this post by Lukas Renggli
Hi Lukas, I tried really hard to get your method to work, but so far  
I have failed. I took your exact sample, and used it in my  
renderContentOn method for the ClockDisplay. The WEB page ends up  
with a "Strings only store Characters" error.

Sorry, I'm very new to Smalltalk, Seaside, VW, and WEB programming,  
but it is turning into a little bit of an obsession. I'm using VW 7.4  
with the SeasideForWebToolkit 2.6a2 image. Any suggestions where I  
should look next? Perhaps, I have incompatible images.

Also, my example might have been a little simplistic. I used a clock,  
but really I'm modeling a simplistic traffic control system for  
helping me learn Smalltalk and Seaside. There is a TrafficLight  
Controller, which is a WATask, a TrafficLight, and  a  
TrafficLightDIsplay.  The controller updates the TrafficLight based  
on various algorithms. The TrafficLightDisplay is a WAComponent and  
displays a red or green image of a traffic light. Ultimately, I would  
like the controller to change the light and the display to be updated/
triggered immediately. So, if I set the frequency to say 1 sec, then  
your method would probably be sufficient for my purposes right now.  
This is only an educational pursuit at the moment. But, I'm wondering  
if I'll need to go to SeasideAsync or Scriptaculous or if there is a  
way to trigger a new rendering using something more similar to what  
you have provided.

Regards --Roland

On Mar 15, 2006, at 11:50 AM, Lukas Renggli wrote:

>> Clock>>renderContentOn: html
>>    html paragraph
>>       script: (html periodical
>>          frequency: 60
>>          on: [ :r | r render: Time now ])
>
> Oups, this should rather be:
>
>     html paragraph
>        script: (html periodical
>           frequency: 60;
>           callback: [ :r | r render: Time now ])
>
> Sorry,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

Roland Hochmuth
Hi Lucas and Cédrick,  Thanks for your responses. I finally followed  
up with SeasideAsync and got my little traffic light changing using  
refreshDivWith. I think I'm starting to get the hang of this.

Regards --Roland
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

Michel Bany-3
Roland Hochmuth a écrit :

> Hi Lucas and Cédrick,  Thanks for your responses. I finally followed  
> up with SeasideAsync and got my little traffic light changing using  
> refreshDivWith. I think I'm starting to get the hang of this.
>
Lukas and Cédrick were referring to features that are available in the
Scriptaculous package.
This is really bleeding edge and requires the very latest version of
Seaside 2.6a3.
None of this has been ported (yet) to VisualWorks.

Meanwhile, SeasideAsync is what you need. Since you are using
#refreshDivWith:every:
I am assuming that you are using the classic api. For the canvas api,
there is also #refreshWith:every:

Enjoy,
Michel.


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

vaidasd
In reply to this post by cbeler
> Have a look at scriptaculous examples... there are code samples
>
> http://scriptaculous.seasidehosting.st

Note, that after poking around in that place I got my processor used
100% in firefox 1.0.7

--
Vaidotas Didžbalis

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically updating a WEB page

cbeler


Vaidotas Didžbalis a écrit :

>>Have a look at scriptaculous examples... there are code samples
>>
>>http://scriptaculous.seasidehosting.st
>>    
>>
>
>Note, that after poking around in that place I got my processor used
>100% in firefox 1.0.7
>  
>
yes I think I have the same problem sometimes with 1.0.7 you use Ubuntu
? :)
if you install 1.5, it should be better (I noticed no problem with it)

On the scrip.aculo.us they are recommending this version


Cédrick

--------------------------------
L'ENIT vous invite a sa journee portes ouvertes le 17 mars 2006 de 13h30 a 19h30

Enit , 47 avenue d'Azereix 65000 Tarbes
 Bus N°1, arret ENI

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside