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.
Re: WebSocket feature request: is it possible to call write function when full frame is loaded only?
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 3 Feb 2023 09:27:38 +0100 (CET)
On Fri, 3 Feb 2023, Vitalii B. Avramenko via curl-library wrote:
> Such partial data may be OK for HTTP protocol when we know for sure that we
> have "request/response" pattern and we can detect the end of data by HTTP
> protocol itself, for example, with `Content-Length` header. But with
> websocket generally speaking we don't have any way to know where is end of
> frame with `CURLOPT_WRITEFUNCTION`.
Yes we do: curl_ws_meta() is provided to give you exactly that information!
> we need a guarantee that `CURLOPT_WRITEFUNCTION` will call our callback when
> full frame is downloaded only, or at least we need the option that will
> allow us to request such behavior (something like
> `CURLOPT_WEBSOCKET_FULL_FRAMES_ONLY`).
I have been thinking about adding a mode for the websocket API that delivers
full frames only, but I have hesitated a bit since frames can be up to 2^63
bytes big we need to decide on how to handle (too) big frames for such a mode.
What do you think is a reasonable behavior for a full-frame mode when it
receives (ridiculously) large frames?
Date: Fri, 3 Feb 2023 09:27:38 +0100 (CET)
On Fri, 3 Feb 2023, Vitalii B. Avramenko via curl-library wrote:
> Such partial data may be OK for HTTP protocol when we know for sure that we
> have "request/response" pattern and we can detect the end of data by HTTP
> protocol itself, for example, with `Content-Length` header. But with
> websocket generally speaking we don't have any way to know where is end of
> frame with `CURLOPT_WRITEFUNCTION`.
Yes we do: curl_ws_meta() is provided to give you exactly that information!
> we need a guarantee that `CURLOPT_WRITEFUNCTION` will call our callback when
> full frame is downloaded only, or at least we need the option that will
> allow us to request such behavior (something like
> `CURLOPT_WEBSOCKET_FULL_FRAMES_ONLY`).
I have been thinking about adding a mode for the websocket API that delivers
full frames only, but I have hesitated a bit since frames can be up to 2^63
bytes big we need to decide on how to handle (too) big frames for such a mode.
What do you think is a reasonable behavior for a full-frame mode when it
receives (ridiculously) large frames?
-- / daniel.haxx.se | Commercial curl support up to 24x7 is available! | Private help, bug fixes, support, ports, new features | https://curl.se/support.html -- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2023-02-03