cURL / Mailing Lists / curl-library / Single Mail


Re: (Secure) Websockets using libcurl

From: Frank Meier <>
Date: Wed, 18 May 2016 11:25:14 +0200

On 17/05/16 17:23, Patrick Rathje wrote:
> Hey,
> I am using libcurl for HTTP(s) already.
> Now I would like to support Secure Websockets as well, but could not really find much information how this is done using libcurl.

Hi Patrick

If you like to get your hands dirty, you could have a look at my
approaches (patches) mentioned in

The second patch which enables you to retrieve the the active connection
socket I use productively for some time now.

This approach let libcurl do the HTTP part of the upgrade, and as your
code detects that the WebSocket-Upgrade is accepted by the server (got
101 and correct response headers), you set CURLPAUSE_ALL on the
easyhandle, and then use curl_easy_recv() and curl_easy_send() to
receive/send websocket data on the established connection. You also need
to get the socket of the easyhandle with CURLINFO_ACTIVESOCKET so you
can poll() on it.

cheers, Frank

List admin:
Received on 2016-05-18