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: is it posible using websocket API with multi handlers with select?

From: Josť Luis Zabalza Cestau via curl-library <>
Date: Tue, 1 Aug 2023 07:27:06 +0000

Thanks Daniel but I don't think it is a bug. I think something is missing in the code.

I attatch a NODE WebServer example (tar.bz2) using library and a multy-legacy.c modified code.

wssserver.js set up a little web server with two functions
- http://localhost:8080/query return a json object (query data)
- ws://localhost:8080/ws begins a websocket connection. Firstly, it sends a json object (Connection Data) and then it continues periodicaly sending another json object (Periodic data) every second.

multi-legacy-ws.c is a bit complicated. It begins printing a menu and waiting for a keyboard command.

- "q" command exit the application.
- "h" command prints menu.
- "p" command sends a http://localhost:8080/query get request
- "w" command begins a websocket only connection to ws://localhost:8080/ws

multi-legacy-ws.c: has a main while loop waiting for quit command and internaly has a loop waiting for select actions, keyboard or multi curl handlers actions. When a action is found, it gets out of the select loop and it check if is a keyboard action or curl action.

When a curl handler action is found, a curl_multi_info_read() loop begins for get the curl handler actions. If WS handler transfer is complete, the received data is read with curl_ws_recv() function.

Now, I think I have to do something but I don't know what for "reload" the WS handler. I try remove and add WS handler from the multi handler, but don't work.

Thanks for the help.

Note: I am using libcurl 7.88.1 on Ubuntu 22.04.2 LTS

De: Daniel Stenberg <>
Enviado: lunes, 31 de julio de 2023 17:51
Para: Josť Luis Zabalza Cestau via curl-library <>
Cc: Josť Luis Zabalza Cestau <>
Asunto: Re: is it posible using websocket API with multi handlers with select?

Correo enviado desde un remitente externo.
Considera este correo como potencialmente peligroso si contiene adjuntos o enlaces a direcciones de internet

On Mon, 31 Jul 2023, Josť Luis Zabalza Cestau via curl-library wrote:

> My first try was a modified
> example. I can read a command from keyboard, send a http query, and connect
> to websocket, at time but periodic data received form websocket don't wakeap
> the select.

That sounds like a bug!

Do you have a way (for us) to reproduce this? Can to submit this as a new
issue over at ?

  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features

Received on 2023-08-01