WebSocket in Curl
WebSocket in Curl URL WebSocket Communication URL WebSocket communication with libcurl is achieved by setting up a transfer to a URL using ws:// or wss:// URL schemes. The latter is the secure version, handled over HTTPS. When using wss:// (WebSocket over HTTPS), standard TLS and HTTPS options are acknowledged for the CA and certificate verification. WebSocket communication is done by upgrading a connection from either HTTP or HTTPS. When given a WebSocket URL, libcurl considers it a transfer failure if the upgrade procedure fails. This means that a plain HTTP 200 response code is considered an error for this work. API The WebSocket API is described in the individual man pages for the new API. libcurl can handle WebSocket communication in two ways: Get the WebSocket frames from the server sent to the write callback. You can then respond with curl_ws_send() from within the callback (or outside of it). Set CURLOPT_CONNECT_ONLY to 2L (new for WebSocket). This makes libcurl...