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: Experimental websocket API

From: Thomas Glanzmann via curl-library <curl-library_at_lists.haxx.se>
Date: Sat, 29 Oct 2022 14:46:56 +0200

Hello,
libcurl websocket appears to work for me. The issue was that I set the
CURLWS_CONT where I should not have set it. With the line corrected:

- ret = curl_ws_send(curl, tooptr, n, &ncurl, 0, CURLWS_BINARY | CURLWS_CONT);
+ ret = curl_ws_send(curl, tooptr, n, &ncurl, 0, CURLWS_BINARY);

It works. :-)

But I also head to assume that all data got sent because the header size
varies:

- ncurl -= 6;
+ ncurl = n;

But than it works (I also disabled debugging, to see something):

(mini) [~/curlwebsocketplayground] ssh -o ProxyCommand="./wsconnect" localhost
Linux mini 6.1.0-rc2-asahi-ARCH+ #6 SMP PREEMPT_DYNAMIC Thu Oct 27 18:34:27 CEST 2022 aarch64
Last login: Sat Oct 29 14:44:03 2022 from 127.0.0.1
(mini) [~] exit
logout
Connection to localhost closed.
websocket: close 1006 (abnormal closure): unexpected EOF
(mini) [~/curlwebsocketplayground] EOF

It still hangs sometimes, but this is very likely a bug in my example application.

I updated the source code.

Cheers,
        Thomas
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-10-29