JCMais / node-libcurl

libcurl bindings for Node.js
https://npmjs.org/package/node-libcurl
MIT License
666 stars 118 forks source link

Cannot read headers when connecting to websocket using ssl. #377

Closed ghost closed 8 months ago

ghost commented 1 year ago

Hi, I am learning and using node-libcurl for my application, it is a very good library in nodejs. I love it very much. But in fact I am facing new problem connecting websocket using ssl.

Describe the bug I have followed your 21-websockets-client.js example but am unable to read the Response Headers returned when connecting to any https(wss) socket server.

Response:

let receivedData = receiveData(easyHandle);
console.log(receivedData.toString());
[
'\x00\x00\x12\x04\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00�\x00\x04\x00\x01\x00\x00\x00\x05\x00�� �\x00\x00\x04\b\x00\x00\x00\x00\x00\x7F�\x00'
]

Can you try to test and write an example of websocket connecting to https using ssl?. This is very useful to use with real servers. Here is the server and I use it to test: wss://demo.piesocket.com/v3/channel_123?api_key=VCXCEuvhGcBDP7XhiJJUDvR1e1D3eiVjgZ9VRiaV&notify_self (https://www.piesocket.com/websocket-tester) Thank you very much for this.

Version information:

Version: libcurl/7.79.1 OpenSSL/1.1.1l zlib/1.2.11 brotli/1.0.9 zstd/1.4.9 libidn2/2.1.1 libssh2/1.10.0 nghttp2/1.45.1 OpenLDAP/2.4.47
Protocols: dict, file, ftp, ftps, gopher, gophers, http, https, imap, imaps, ldap, ldaps, mqtt, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Features: AsynchDNS, Debug, TrackMemory, IPv6, Largefile, NTLM, NTLM_WB, SSL, libz, brotli, TLS-SRP, HTTP2, UnixSockets, HTTPS-proxy, alt-svc

OS: Node.js Version: 16.18.1