[Seaside] Update an image with AJAX/Comet (server push)

Jochen ich at nichtich.com
Tue Oct 6 02:37:24 UTC 2009


I'm developing a web application in that i need to update an image 
element very often but neither periodically nor on user input. The image 
gets computed on the server as a Form-object. I'm trying to realize this 
with Comet:

    TestApp>>renderContentOn: html
        html span
            id: #display;
            with: [ html image form: (self getDisplayForm) ].
        html submitButton
            onClick: (html request callback: [ self update ]);
            with: 'update'.
        html script: (html comet
            pusher: self pusher;

        self pusher javascript: [ :script |
            script element
                id: #display;
                update: [ :html | html image form: (self getDisplayForm) 
] ].

The method 'getDisplayForm' computes a new Form-object on the fly.

When I click the Button 'update' it works as expected (the form gets 
computed and the image on my website updates immediately). But when I 
perform the 'update' method from outside this class (every time when a 
new image is available that is computed somewhere else), I get this error:

    UndefinedObject>>doesNotUnderstand: #application
        ^ WACurrentSession value application

Afaik the problem is the missing WACurrentSession and because of that 
it's not possible to compute a temporary URL for the image.

But I don't understand, why one time my 'update' method works (after the 
button click) and one time not (when I perform the 'update' method 

Can anybody explain this strange behavior? Or does someone have another 
idea how I can update an image with server push (without user input or 
site reload)? I would be very very happy to get some new ideas! - It's 
an important part of my master thesis..


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20091006/200fce25/attachment.htm

More information about the seaside mailing list