libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] large incremental responses


From: Evgeny Grin
Subject: Re: [libmicrohttpd] large incremental responses
Date: Fri, 3 Dec 2021 14:09:43 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2

Hi Erik,

You need to create response by MHD_create_response_from_callback(). Use 'MHD_SIZE_UNKNOWN' if size is not known in advance. When data callback is called by MHD, provide all data you have at that moment (but not more than requested by MHD of course). If you don't have any data available call MHD_suspend_connection(). Later, when you get new portion of data ready to send, call MHD_resume_connection() then data callback will be called automatically by MHD.

Does it suit your needs?

--
Evgeny

On 02.12.2021 21:53, Erik Smith wrote:
If I want to send a large response that takes time to generate and have the response sent incrementally in a push style (regular write calls in synchronous code, not callbacks) so that the client doesn't time out, how would I do that?  Is that something I'm going to have to write some concurrency mechanism for so that I can use a callback or is there a simpler way?



Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]