Buffering of chunked responses



I'm using libsoup in a server role and I want to be able to send status messages from the server to web clients while the server is performing certain tasks. To do that I'm using XMLHttpRequest in the client with chunked responses from the server. Each status message is a chunk of JSON terminated by LF, and I call soup_message_body_append_take(), followed by soup_server_unpause_message() for each line.

The trouble is, the client is getting the messages in chunks containing several lines at a time, meaning the first message in a received chunk can be a few seconds late. I've checked the "wrote-chunk" and "wrote-body-data" signals, and these do seem to be getting fired immediately after sending a line with the above functions. So whatever's combining the lines doesn't seem to be libsoup itself, but I thought maybe there could be some buffering in gio or whatever causing this. If so, is there a way to access the SoupMessage's socket at a lower level and flush any buffer there might be?

OTOH, if it's the browser doing this buffering, is there a way to prevent it in XMLHttpRequest?

--
TH


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