Yes, although the logic is more complex, I can have the bound function callback 
into the shared object to retrieve the data that I wanted to pass to the bound 
function.

For my application, I have a UIServer object (1 per session) and a StatusServer 
(singleton), which relays status messages between sessions.
UIServer ctor calls
 StatusServer::connect( this, 
     wApp->bind( boost::bind( &UIServer::notifyStatusEvent, this) )) 

StatusServer::postStatusEvent() will save a copy of the event in a per-session 
queue.
and  calls WServer::post(sessionid, callback), which indirectly calls
UIServer::notifyStatusEvent()

UIServer::notifyStatusEvent() calls 
StatusServer::getEvent() to retrieve the event, and call
UIServer::processStatusEvent() to handle the StatusEvent.


It would be quite helpful if <Wt_src>/examples/simplechat used 
WApplication::bind().  

I appreciate any examples, but examples that correctly handle real-world 
situations, like browser sessions being closed are MUCH more useful.  As far as 
I can tell, because simplechat doesn't use WApplication::bind(), it may not 
safely handle browser sessions that are closed. 

If I get the chance, I'll submit a rewritten simplechat example that uses 
WApplication::bind(), but as they say "It won't be pretty!"


On Nov 13, 2012, at 4:44 AM, Koen Deforche wrote:

> Hey Joseph, Rob,
> 
> I guess you are both indicating a limitation: WApplication::bind()
> essentially returns a function without arguments, and thus all
> arguments already have to be bound before the call, which makes it
> useless when you want to pass on information from the external source.
> 
> As a workaround, perhaps you can rather than 'push' new information,
> make the bound function 'poll' the information from the shared object
> ?
> 
> I believe it should be possible to make WApplication::bind() work
> properly with any kind of function, including functions with free
> parameters -- although that requires a bit of digging into the
> meta-function possiblities of boost-ified c++...
> 
> In any case, using WApplication::bind() later on is not very useful --
> it needs to happen with the session lock and with the objects bound
> guaranteed to be alive at the moment of calling WApplication::bind().
> 
> Regards,
> koen
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to