HTTP_SERVER - Websocket Async Connection.

User avatar
Coffeeye
Posts: 7
Joined: Tue Nov 09, 2021 9:59 am

HTTP_SERVER - Websocket Async Connection.

Postby Coffeeye » Thu Jun 09, 2022 10:38 am

Hello!,

I have successfully managed to send logs via ws_echo_example to my browser.

Code: Select all

{.uri = "/ws", .method = HTTP_GET, .handler = websocket_get_handler, .user_ctx = NULL,  .is_websocket = true, .handle_ws_control_frames = true, .supported_subprotocol = "chat"},
I am receiving data inside

Code: Select all

socket.onmessage = function(event) {};
and javascript does the rest.

But I also wish to send commands to esp console (so I can actualy work with those logs).

I have another uri whish simply send's user buffer to esp_console_run

Code: Select all

{.uri = "/console", .method = HTTP_POST, .handler = console_post_handler, .user_ctx = NULL},
But this is under the same httpd_handle_t from the same httpd_req_t
and sending anything does not work until websocket is open.

Any ideas?
Programming in C and JS using ESP-IDF on esp32-d0wd-v3

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 100 guests