curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Detecting final WebSocket frame of a fragmented message

From: Paul Fotheringham via curl-library <>
Date: Tue, 11 Jul 2023 17:35:19 +0100


I've been using libcurl for some months now and recently tried to get
WebSocket going in CURLOPT_CONNECT_ONLY=2L mode. The problem I'm
having is if the server sends a message fragmented over multiple
frames then I cannot work out how I am meant to know when the final
frame of the message is received via curl_ws_recv. Even if it is not
fragmented then I get the whole message but again I guess I don't know
that the message is finished.

My understanding of WebSocket is that only the final frame (might be
the only frame) has the FIN bit set in the header but I see no
corresponding exposure of that in the API and a quick scan of the code
seems to suggest it is not being passed out in any way. The server is
mine too so I may have a bug but at the same time I just don't see how
I'm meant to detect the final frame.

I understand WebSocket support is still experimental so I'm wondering
if I am missing something or if this is just not available yet?

Received on 2023-07-11