“wrote-chunk” is emitted when a chunck was sent to inform the app to provide another chunkc of data. To send another chunk, just append the new block of bytes (GBytes or guint8*) to SoupMessageBody of your SoupServerMessage…you can use soup_message_body_append_bytes (body, chunk);
when there is no more byte to send you should call (inside your handler) soup_message_body_complete to inform libsoup about that…libsoup will stop emitting “wrote-chunck” again and will transision to “finished” and “disconnected”
RECEIVING PART
you just need to handle “got-chunck” and “got-body”.
check if this is the first reception, open the store (file, database etc)
if it the case on every “got-chunk” serialize the received bytes to the store on “got-body”, finalize the job and close the store that all
to send in chuncked-encoding from the client side use soup_message_set_request_body with a length of -1;
There is an API but behind the scene. What is important is set the enconding to SOUP_ENCODING_CHUNKED on the headers and define the “content-length” to -1 and finally connecto the relevant signal “got-" or "wrote-” “finished” “disconnected” etc
It is very simple to use soup_message_set_request_body (I use libsoup 3.4.2).