cpprest server to report progress status

Aug 3, 2015 at 9:14 AM

I've got a REST server, http_listener, that one of its served requests need to report progress back to browser before sending out the final OK.

The request monitors a DB table and reports back every second, over a period predefined period of time.
When the monitoring period finishes, a 200 will be send back to end the request.

How can I do this in cpprest?

I've tried all sort of things with ostreams etc but nothing works; it either does not compile or does not have the desired behaviour.

Many thanks,
Aug 3, 2015 at 7:39 PM
Edited Aug 3, 2015 at 7:39 PM

I don't think we can support that sort of flow within a single HTTP request. You could try sending multiple requests, or you could look into websockets (this sounds like exactly what websockets was designed for).

We do not currently support websockets on the server side, however the library we build on top of (websocket++) does support it. If you implement server-side websockets on top of websocket++, consider contributing it back to the library.

Aug 4, 2015 at 9:26 PM
Hi roschuma,

Thanks for your reply!

I see.

I do not like big promises but I've noted this down a future TODO for me.
Rest assured that when I get around to it, I will commit it as a contrib; will be more than glad to do so.

Many thanks,