41#define CATEGORY "/res/websocket/"
42#define REMOTE_URL "ws://127.0.0.1:8088/ws"
49 const char write_buf[] =
"this is only a test";
54 info->name = __func__;
55 info->explicit_only = 1;
57 info->summary =
"test creation and connection of a client websocket";
58 info->description =
"test creation and connection of a client websocket";
81 info->name = __func__;
83 info->summary =
"websocket client - test bad url";
84 info->description =
"pass a bad url and make sure it fails";
102 info->name = __func__;
104 info->summary =
"websocket client - unsupported protocol";
105 info->description =
"fails on an unsupported protocol";
119 const char *accept_protocol;
124 info->name = __func__;
126 info->summary =
"websocket client - test multiple protocols";
127 info->description =
"test multi-protocol client";
137 ast_test_validate(
test, accept_protocol && !strcmp(accept_protocol,
"echo"));
164 .
requires =
"res_http_websocket",
Asterisk main include file. File version handling, generic pbx functions.
void write_buf(int file, char *buffer, int num)
Support for WebSocket connections within the Asterisk HTTP server and client WebSocket connections to...
int ast_websocket_read_string(struct ast_websocket *ws, char **buf)
Read a WebSocket frame containing string data.
ast_websocket_result
Result code for a websocket client.
struct ast_websocket * ast_websocket_client_create(const char *uri, const char *protocols, struct ast_tls_config *tls_cfg, enum ast_websocket_result *result)
Create, and connect, a websocket client.
const char * ast_websocket_client_accept_protocol(struct ast_websocket *ws)
Retrieve the server accepted sub-protocol on the client.
int ast_websocket_write_string(struct ast_websocket *ws, const char *buf)
Construct and transmit a WebSocket frame containing string data.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Core PBX routines and definitions.
Structure definition for session.
#define AST_TEST_REGISTER(cb)
#define AST_TEST_UNREGISTER(cb)
AST_TEST_DEFINE(websocket_client_create_and_connect)
static int load_module(void)
static int unload_module(void)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.