It seems like Comet would be hard to implement in web2py. Does web2py use a threadpool internally? If so, I can see you run out of threads pretty quickly. Ideally you would like to solve these kind of problems with an asynchronous model (think Gevent, Eventlet, Concurrence, Toranado). I am working on a project which requires a lot of slow processing (image resizing, sending emails) based on client initiated calls. Massimo, have you considered an asynchronous model within web2py? Curious about your thoughts on it. I would much rather handle the long running tasks in a green thread then to block a complete thread.
My first post here and just started to work with web2py on a social site. Great work Massimo! Batteries included but still light. On May 25, 9:39 pm, Candid <roman.bat...@gmail.com> wrote: > Well, actually there is a way for the server to trigger an action in > the browser. It's called comet. Of course under the hood it's > implemented on top of http, so it's browser who initiates request, but > from the developer perspective it looks like there is dual channel > connection between the browser and the server, and they both can send > messages to each other asynchronously. There are several > implementation of comet technology. I've used Orbited (http:// > orbited.org/) and it worked quite well for me. > > On May 25, 9:00 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > I would use a background process that does the work and adds the items > > to a database table. The index function would periodically refresh or > > pull an updated list via ajax from the database table. there is no way > > for te server to trigger an action in the browser unless 1) the > > browser initiates it or 2) the client code embeds an ajax http server. > > I would stay away from 1 and 2 and > > use reload of ajax. > > > On May 25, 5:33 pm, Giuseppe Luca Scrofani <glsdes...@gmail.com> > > wrote: > > > > Hi all, as promised I'm here to prove you are patient and nice :) > > > I' have to make this little app where there is a function that read > > > the html content of several pages of another website (like a spider) > > > and if a specified keyword is found the app refresh a page where there > > > is the growing list of "match". > > > Now, the spider part is already coded, is called search(), it uses > > > twill to log in the target site, read the html of a list of pages, > > > perform some searching procedures and keep adding the result to a > > > list. I integrated this in a default.py controller and make a call in > > > def index(): > > > This make the index.html page loading for a long time, because now it > > > have to finish to scan all pages before return all results. > > > What I want to achieve is to automatically refresh index every 2 > > > second to keep in touch with what is going on, seeing the list of > > > match growing in "realtime". Even better, if I can use some sort of > > > ajax magic to not refresh the entire page... but this is not vital, a > > > simple page refresh would be sufficient. > > > Question is: I have to use threading to solve this problem? > > > Alternative solutions? > > > I have to made the list of match a global to read it from another > > > function? It would be simpler if I made it write a text file, adding a > > > line for every match and reading it from the index controller? If I > > > have to use thread it will run on GAE? > > > > Sorry for the long text and for my bad english :) > > > > gls