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.

RE: About a websockets write callback

From: Dmitry Karpov via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 21 Jun 2022 20:06:23 +0000

Yes, I agree that having something working for WS will be a good step forward regardless the approach.
And you have enough food for thinking. 😊

I just was trying to point out that WebSocket is a protocol above the HTTP transport layer, and it seems logical to me to separate data callbacks for high-level protocols (which require protocol context in order to understand the data) from "raw" layer 0 transport protocols, even though it is definitely possible to put everything into a single CURLOPT_WRITEFUNCTION callback paying some efficiency or easiness price.

Thanks,
Dmitry Karpov


-----Original Message-----
From: Daniel Stenberg <daniel_at_haxx.se>
Sent: Tuesday, June 21, 2022 10:11 AM
To: Dmitry Karpov via curl-library <curl-library_at_lists.haxx.se>
Cc: Dmitry Karpov <dkarpov_at_roku.com>
Subject: RE: About a websockets write callback

On Mon, 20 Jun 2022, Dmitry Karpov via curl-library wrote:

> Yes, it would be nice to have just one callback for all WS modes (RAW,
> FRAME, MESSAGE) but using CURLOPT_WRITEFUNCTION callback for that
> purpose doesn't seem like an optimal solution to me because of the
> problems related to passing curl handle to it and making a function
> call to get WS context metadata.

Right, we have to pick one of the two ways where neither is optimal.

I still think I'm going to try with a single CURLOPT_WRITEFUNCTION callback to start with and a "curl_ws_meta()" function that can be used from within that callback to get additional data about the frame - when used in frame mode.

I think getting something working that we can try with is a good thing and then if this turns out feeling too awkward and special, we can switch it around and do a separate callback option instead.

--

  / 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.html
Received on 2022-06-21