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: Dan Fandrich via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 17 Jun 2022 23:38:29 -0700

On Fri, Jun 17, 2022 at 01:39:00PM +0200, Daniel Stenberg via curl-library wrote:
> I would like to provide websockets data with the CURLOPT_WRITEFUNCTION
> callback as well. But how would libcurl provide the additional necessary
> metadata?

I'm admittedly not very familiar with websockets, but would it make sense to
move the abstraction up a layer? In other words, giving each web socket its own
easy handle with its own set of websocket parameters. The different easy handles
would be tied to a single web socket transport via a multi handle with curl
handling the multiplexing of websocket data onto a single transport. That way
no extra data would need to be sent in each write callback; any such data would
instead be tied to the easy handle. I don't know how often things like opcode
would need to be changed, but they could be set on the appropriate handle using
curl_easy_setopt whenever necessary.

Dan
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-06-18