ws_connect
-
ws_connect(const struct ws_connect_options *options)
Connects to a server.
int client_callback(struct ws_client *client, enum ws_event event, void *user) { switch(event) { case LIBWS_EVENT_CONNECTED: // connected to server break; case LIBWS_EVENT_RECEIVED: // received data from server break; default: break; } return 0; } struct ws_connect_options options; options.context = context; options.host = "a.b.c.d"; options.port = 1234; options.callback = client_callback; struct ws* ws = ws_connect(&options);
- Parameters
options – [in] Connect options
- Returns
A new websocket, or NULL.