I was thinking if this would not be an option for you: 1. Use WSocketNotifier for the events on your file descriptors 2. Write your code as if server push would be availabe 3. At the moments that you'd need the server push functionality in situations where JavaScript is not available, do the following: - check for JavaScript with WEnvironment::JavaScript() - if not available, instantiate and start a WTimer, with an appropriate timeout for your application (1 sec, 10 sec, 30 sec, 1 minute, ...) - connect a dummy server-side function to your WTimer (one that does nothing)
The fact that the timer event arrives in Wt, will cause Wt to check for changes in the widget tree, and they will be sent to the client. You'll have the added benefit that your application remains responsive while your calculations (or whatever) is going on. Would this solution be ok for you? All of this is available in Wt right now. BR, Wim. 2010/11/10 u.nn <[email protected]>: > Hi, > > I'm looking at using libwt, but there's something I'd like to be able to > do that I'm not seeing in the documentation. I'm new to libwt and all, > so feel free to correct whatever may be wrong in the following. > > I think, normally when the WApplication constructor is called or some > signal callback is called, the application code adds various widgets and > whatnot, and then the callback or constructor returns, the page is > rendered and sent to the client (or for AJAX clients, the screen updates > are sent, etc). > > What I would like, however, is the ability to postpone rendering or data > being pushed to the client until some other data is received. For > instance, if I want to wait until receiving data from a file descriptor > for some database connection or an authentication service, etc etc, I'd > like to be able to hand that file descriptor to the event loop that > libwt is using, and have some callback or something called from there. I > figure I can do that by hooking in to the io_service in > http::server::Server or whatever it's called, but this doesn't really > help if the response has already been pushed out. > > What I would like is a way to tell wt to not render/flush/etc when the > function in question returns control to wt, but to only render when I > call some function (I assume something like flush() in WebResponse or > something). Does this exist? > > I'm not sure if I'm just bad at browsing the documentation, but I > haven't found it. I am fairly certain that I am _not_ looking for > enableUpdates()-style server-initiated updates or "comet"-style events, > because I want to be able to do this without requiring AJAX. For plain > HTML requests (at least), I just want to delay sending the page to the > client until I have received all of the data I need, without blocking > the current thread. > > The closest thing I have found to what I want looks like > Wt::Http::Response's createContinuation() method, but I don't see much > documentation that makes it clear how to use it. I get the feeling, > though, that this is intended for when an application is dynamically > generating some document (like a PDF or an image or something), and not > for general UI rendering, but I could be way off. > > And if this does not yet exist in wt, would there be opposition to > adding something like this? > > ------------------------------------------------------------------------------ > The Next 800 Companies to Lead America's Growth: New Video Whitepaper > David G. Thomson, author of the best-selling book "Blueprint to a > Billion" shares his insights and actions to help propel your > business during the next growth cycle. Listen Now! > http://p.sf.net/sfu/SAP-dev2dev > _______________________________________________ > witty-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
