-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
28 lines (20 loc) · 835 Bytes
/
main.c
File metadata and controls
28 lines (20 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "websocket_handler.h"
int main(void) {
// Structure to hold the configuration information for the WebSocket context.
struct lws_context_creation_info info;
// Pointer to the WebSocket context, which manages all WebSocket operations.
struct lws_context *context;
// Initialize the WebSocket context creation structure with default settings.
initialize_websocket(&info);
// Create the WebSocket context using the initialized configuration.
context = lws_create_context(&info);
if (!context) {
fprintf(stderr, "Failed to create WebSocket context\n");
return -1;
}
// Start the WebSocket connection and enter the main event loop.
connect_and_loop(context);
// Clean up and destroy the WebSocket context.
lws_context_destroy(context);
return 0;
}