rabbitmq-c
0.5.3
C AMQP Client library for RabbitMQ
|
Go to the source code of this file.
Data Structures | |
struct | websocket_message_event_t |
websocket_message_event_t struct. More... | |
Typedefs | |
typedef struct websocket_t_stct | websocket_t |
websocket_t is a struct refer to WebSocket object. | |
Functions | |
websocket_t * | websocket_new () |
websocket_new Creates a websocket_t object. | |
void | websocket_free (websocket_t *ws) |
websocket_free Frees websocket_t object from memory. | |
int | websocket_connect (websocket_t *ws, const char *location, const char *protocol, const char *extension) |
websocket_connect Connections with the server. | |
int | websocket_send_text (websocket_t *ws, const char *text) |
websocket_send_text Sends a NULL terminated string to server. | |
int | websocket_send_binary (websocket_t *ws, const char *binary, size_t size) |
websocket_send_binary Sends a binary block data to server. | |
int | websocket_send_binaryv (websocket_t *ws, const struct iovec *iov, int iovcnt) |
websocket_send_binaryv Sends multiple binary blocks data to server. | |
int | websocket_close (websocket_t *ws) |
websocket_close Disconnects with the server. | |
int | websocket_close_with_reason (websocket_t *ws, int code, const char *reason) |
websocket_close Disconnects with the server with code and reason. | |
websocket_message_event_t * | websocket_recv (websocket_t *ws) |
websocket_recv Receive data from the WebSocket connection. | |
const char * | websocket_url (websocket_t *ws) |
websocket_url Gets the url of the connection. | |
int | websocket_readystate (websocket_t *ws) |
websocket_readystate returns the readstate of the WebSocket connection. | |
const char * | websocket_protocol (websocket_t *ws) |
websocket_protocol Gets names of all the enabled protocols that have been successfully negotiated between the client and the server during the initial handshake. | |
const char * | websocket_extension (websocket_t *ws) |
websocket_extension Gets names of all the enabled extensions that have been successfully negotiated between the client and the server during the initial handshake. | |
int | websocket_ssl_set_cacert (websocket_t *ws, const char *cacert) |
websocket_ssl_set_cacert Sets the ca certificate store for SSL WebSocket connection. | |
int | websocket_ssl_set_clientkey (websocket_t *ws, const char *cert, const char *key) |
websocket_ssl_set_cacert Sets the client certificates and client key file for SSL WebSocket connection. | |
int | websocket_ssl_set_verify_callback (websocket_t *ws, int(*callback)(int preverify_ok, X509_STORE_CTX *ctx)) |
websocket_ssl_set_verify_callback Sets the client verify callback function for SSL WebSocket connection. |
typedef struct websocket_t_stct websocket_t |
websocket_t is a struct refer to WebSocket object.
WebSocket provides bi-directional communications for text and binary messaging via the Kaazing Gateway. Refer to http://www.w3.org/TR/websockets/ for the published standard W3C WebSocket API specification.
int websocket_close | ( | websocket_t * | ws | ) |
websocket_close Disconnects with the server.
ws | pointer of websocket_t object |
int websocket_close_with_reason | ( | websocket_t * | ws, |
int | code, | ||
const char * | reason | ||
) |
websocket_close Disconnects with the server with code and reason.
based on RFc-6455, WebSocket client can disconnect with its own data.
ws | pointer of websocket_t object |
code | int close code that is sent to server. the code must equal to 1000 or in range 3000 to 4999 |
reason | pointer of null terminated string that is sent to server, the reason length must be less than 127 |
int websocket_connect | ( | websocket_t * | ws, |
const char * | location, | ||
const char * | protocol, | ||
const char * | extension | ||
) |
websocket_connect Connections with the server.
Clients should call send/receive data when the connection has been established.
ws | pointer of websocket_t object |
location | pointer of null terminated string that contains url of server, for example "ws://echo.websocket.org" |
protocol | pointer of null terminated string that contains client's protocol(s). NULL for no protocol. use comma separated format for multiple protocols. for example "protcol1,protocol2" |
extension | pointer of null terminated string that contains client's extension(s). NULL for no protocol. use comma separated format for multiple protocols. for example "extension1 param1=10;param2=test,extension2" |
const char* websocket_extension | ( | websocket_t * | ws | ) |
websocket_extension Gets names of all the enabled extensions that have been successfully negotiated between the client and the server during the initial handshake.
ws | pointer of websocket_t object |
void websocket_free | ( | websocket_t * | ws | ) |
websocket_free Frees websocket_t object from memory.
Clients should always use websocket_free to deallocate websocket_t object instead of call free() directly.
pointer | of websocket_t object |
websocket_t* websocket_new | ( | ) |
websocket_new Creates a websocket_t object.
Clients should always use websocket_new to create websocket_t object instead of malloc directly.
const char* websocket_protocol | ( | websocket_t * | ws | ) |
websocket_protocol Gets names of all the enabled protocols that have been successfully negotiated between the client and the server during the initial handshake.
ws | pointer of websocket_t object |
int websocket_readystate | ( | websocket_t * | ws | ) |
websocket_readystate returns the readstate of the WebSocket connection.
ws | pointer of websocket_t object |
websocket_recv Receive data from the WebSocket connection.
Client calls websocket_recv to retrieve data that was sent from server. This function is a block call. It returns when there is data available on the WebSocket connection. If the connection is disconnected, then a message event with type equals to CLOSED will be returned. After CLOSED event, call websocket_recv will return NULL.
ws | pointer of websocket_t object |
code | int close code that is sent to server. the code must equal to 1000 or in range 3000 to 4999 |
rason | pointer of null terminated string that is sent to server, the reason length must be less than 127 |
int websocket_send_binary | ( | websocket_t * | ws, |
const char * | binary, | ||
size_t | size | ||
) |
websocket_send_binary Sends a binary block data to server.
ws | pointer of websocket_t object |
binary | pointer of binary block that is sent to server. |
int | size length of binary block that is sent to server. |
int websocket_send_binaryv | ( | websocket_t * | ws, |
const struct iovec * | iov, | ||
int | iovcnt | ||
) |
websocket_send_binaryv Sends multiple binary blocks data to server.
ws | pointer of websocket_t object |
iov | pointer of struct iovec that is sent to server. please refer to sys/uio.h for details about iovec |
int | iovcnt size of iovec array that is sent to server. |
int websocket_send_text | ( | websocket_t * | ws, |
const char * | text | ||
) |
websocket_send_text Sends a NULL terminated string to server.
ws | pointer of websocket_t object |
text | pointer of null terminated string that is sent to server, for example "hello websocket" |
int websocket_ssl_set_cacert | ( | websocket_t * | ws, |
const char * | cacert | ||
) |
websocket_ssl_set_cacert Sets the ca certificate store for SSL WebSocket connection.
this function sets the client ca certificate store. refer to openssl document for details. Client should call this function before calling websocket_connect()
ws | pointer of websocket_t object |
cacert | point to the ca cert file location |
int websocket_ssl_set_clientkey | ( | websocket_t * | ws, |
const char * | cert, | ||
const char * | key | ||
) |
websocket_ssl_set_cacert Sets the client certificates and client key file for SSL WebSocket connection.
This function sets the client certificate file and key file. refer to openssl document for details. Client should call this function before calling websocket_connect()
ws | pointer of websocket_t object |
cert | point to the client cert file location |
key | point to the client key file location |
int websocket_ssl_set_verify_callback | ( | websocket_t * | ws, |
int(*)(int preverify_ok, X509_STORE_CTX *ctx) | callback | ||
) |
websocket_ssl_set_verify_callback Sets the client verify callback function for SSL WebSocket connection.
This function sets the client verify callback function . refer to openssl document for details. Client should call this function before calling websocket_connect()
ws | pointer of websocket_t object |
callback | point to client verify callback function |
const char* websocket_url | ( | websocket_t * | ws | ) |
websocket_url Gets the url of the connection.
this function returns the final url of the WebSocket. note: when client connect to kaazing gateway with balancer service. the final url may be different from the original url that client used when connect.
ws | pointer of websocket_t object |