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: curl websockets

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 2 Jul 2021 13:40:36 +0200 (CEST)

On Fri, 2 Jul 2021, Felipe Gasper wrote:

Thanks!

> The send interface could look much like curl_easy_send():
>
> curl_ws_send( easy, buffer, buflen, &sent, enum curl_ws_message_type type,
> enum curl_ws_flags flags )

Or perhaps with the type and flags just made as a single bitmask.

> Most WS libraries that I’ve seen implement reception as a callback, with a
> separate control to pause reception of incoming messages.

I won't say that's wrong, but I don't see how a callback helps with this API.

curl_ws_recv() could just be made to not return until the entire packet can be
returned. Or with an option to return a partial one.

An area for consideration is how to deal with the buffer (size). I mean, if it
wants to wait for a full packet to arrive I suppose it can be large and it
might not fit in the user-provided buffer, so the application would need to
call it multiple times do drain the data.

I took the liberty of jotting down some of these API thoughts in the wiki
page. Still incomplete and not really functional, but I figured it could help
to stir up our collective minds..

   https://github.com/curl/curl/wiki/WebSockets#api

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/


-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-07-02