diff options
Diffstat (limited to 'src/web.c')
-rw-r--r-- | src/web.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -104,6 +104,10 @@ enum MHD_Result handle_request(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) { + (void)version; + (void)upload_data; + (void)upload_data_size; + (void)con_cls; struct MHD_Response *response; enum MHD_Result ret; @@ -126,7 +130,7 @@ enum MHD_Result handle_request(void *cls, struct MHD_Connection *connection, MHD_destroy_response(response); return ret; } - + response = MHD_create_response_from_buffer(strlen(html_content), (void *)html_content, MHD_RESPMEM_PERSISTENT); ret = MHD_queue_response(connection, MHD_HTTP_OK, response); MHD_destroy_response(response); @@ -136,6 +140,7 @@ enum MHD_Result handle_request(void *cls, struct MHD_Connection *connection, // Callback to handle WebSocket events static int callback_ws(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len) { + (void)user; char buf[10000] = ""; char tmp[10000] = ""; switch (reason) { @@ -175,10 +180,10 @@ static int callback_ws(struct lws *wsi, enum lws_callback_reasons reason, lws_write(wsi, (unsigned char *)buf, strlen(buf), LWS_WRITE_HTTP); return -1; break; - } + } case LWS_CALLBACK_CLOSED: { printf("WebSocket connection closed with client: %p\n", wsi); - } + } default: break; } @@ -187,12 +192,13 @@ static int callback_ws(struct lws *wsi, enum lws_callback_reasons reason, // Thread function to run the WebSocket server void *websocket_server_thread(void *arg) { + (void)arg; struct lws_context_creation_info info; struct lws_context *context; struct lws_protocols protocols[] = { //{ "http-only", callback_http, 0, 0 }, - { "ws", callback_ws, 0, 128 }, - { NULL, NULL, 0, 0 } // Terminator + { "ws", callback_ws, 0, 128, 0, 0, 0 }, + { NULL, NULL, 0, 0, 0, 0, 0 } // Terminator }; memset(&info, 0, sizeof(info)); @@ -251,7 +257,7 @@ void ws_send_message(const char *message) { memcpy(&buffer[LWS_PRE], message, msg_len); lws_write(client_wsi, &buffer[LWS_PRE], msg_len, LWS_WRITE_TEXT); printf("[WS]: Sent <<%s>>\n", message); - + //lws_write(client_wsi, (unsigned char *)message, strlen(message), LWS_WRITE_TEXT); } } |