26#ifndef _CURL_WEBSOCKET_H_
27#define _CURL_WEBSOCKET_H_ 1
71 void (*
on_text)(
void *
data, CURL *easy,
const char *text,
size_t len);
82 void (*
on_ping)(
void *
data, CURL *easy,
const char *reason,
size_t len);
86 void (*
on_pong)(
void *
data, CURL *easy,
const char *reason,
size_t len);
145bool cws_send(CURL *easy,
bool text,
const void *msg,
size_t msglen);
150static inline bool cws_send_binary(CURL *easy,
const void *msg,
size_t msglen) {
151 return cws_send(easy,
false, msg, msglen);
158static inline bool cws_send_text(CURL *easy,
const char *
string) {
159 return cws_send(easy,
true,
string, strlen(
string));
171bool cws_ping(CURL *easy,
const char *reason,
size_t len);
185bool cws_pong(CURL *easy,
const char *reason,
size_t len);
void cws_add_header(CURL *easy, const char field[], const char value[])
void cws_free(CURL *easy)
CURL * cws_new(const char *url, const char *websocket_protocols, const struct cws_callbacks *callbacks)
bool cws_close(CURL *easy, enum cws_close_reason reason, const char *reason_text, size_t reason_text_len)
bool cws_ping(CURL *easy, const char *reason, size_t len)
bool cws_pong(CURL *easy, const char *reason, size_t len)
bool cws_send(CURL *easy, bool text, const void *msg, size_t msglen)
cws_close_reason
Definition: curl-websocket.h:38
@ CWS_CLOSE_REASON_NORMAL
Definition: curl-websocket.h:39
@ CWS_CLOSE_REASON_PROTOCOL_ERROR
Definition: curl-websocket.h:41
@ CWS_CLOSE_REASON_MISSING_EXTENSION
Definition: curl-websocket.h:48
@ CWS_CLOSE_REASON_GOING_AWAY
Definition: curl-websocket.h:40
@ CWS_CLOSE_REASON_POLICY_VIOLATION
Definition: curl-websocket.h:46
@ CWS_CLOSE_REASON_TOO_BIG
Definition: curl-websocket.h:47
@ CWS_CLOSE_REASON_SERVER_ERROR
Definition: curl-websocket.h:49
@ CWS_CLOSE_REASON_INCONSISTENT_DATA
Definition: curl-websocket.h:45
@ CWS_CLOSE_REASON_IANA_REGISTRY_END
Definition: curl-websocket.h:51
@ CWS_CLOSE_REASON_IANA_REGISTRY_START
Definition: curl-websocket.h:50
@ CWS_CLOSE_REASON_NO_REASON
Definition: curl-websocket.h:43
@ CWS_CLOSE_REASON_ABRUPTLY
Definition: curl-websocket.h:44
@ CWS_CLOSE_REASON_PRIVATE_END
Definition: curl-websocket.h:53
@ CWS_CLOSE_REASON_UNEXPECTED_DATA
Definition: curl-websocket.h:42
@ CWS_CLOSE_REASON_PRIVATE_START
Definition: curl-websocket.h:52
Definition: curl-websocket.h:56
void(* on_close)(void *data, CURL *easy, enum cws_close_reason reason, const char *reason_text, size_t reason_text_len)
Definition: curl-websocket.h:93
void(* on_ping)(void *data, CURL *easy, const char *reason, size_t len)
Definition: curl-websocket.h:82
void(* on_connect)(void *data, CURL *easy, const char *websocket_protocols)
Definition: curl-websocket.h:63
void(* on_text)(void *data, CURL *easy, const char *text, size_t len)
Definition: curl-websocket.h:71
const void * data
Definition: curl-websocket.h:94
void(* on_binary)(void *data, CURL *easy, const void *mem, size_t len)
Definition: curl-websocket.h:75
void(* on_pong)(void *data, CURL *easy, const char *reason, size_t len)
Definition: curl-websocket.h:86