Lines Matching refs:curl
39 static int ping(CURL *curl, const char *send_payload) in ping() argument
43 curl_ws_send(curl, send_payload, strlen(send_payload), &sent, 0, in ping()
48 static int recv_pong(CURL *curl, const char *expected_payload) in recv_pong() argument
53 CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta); in recv_pong()
77 static CURLcode recv_any(CURL *curl) in recv_any() argument
83 return curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta); in recv_any()
87 static void websocket_close(CURL *curl) in websocket_close() argument
90 (void)curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE); in websocket_close()
93 static void websocket(CURL *curl) in websocket() argument
97 recv_any(curl); in websocket()
98 if(ping(curl, "foobar")) in websocket()
100 if(recv_pong(curl, "foobar")) { in websocket()
105 websocket_close(curl); in websocket()
110 CURL *curl; in main() local
113 curl = curl_easy_init(); in main()
114 if(curl) { in main()
115 curl_easy_setopt(curl, CURLOPT_URL, "wss://example.com"); in main()
117 curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */ in main()
120 res = curl_easy_perform(curl); in main()
127 websocket(curl); in main()
131 curl_easy_cleanup(curl); in main()