I'm writing a websocket server based on the github example "echo websocket"(https://github.com/espressif/esp-idf/tr ... cho_server).
The client always receives packets after sending a message to the server in that implementation, however, is there any way to implement a websocket server that periodically sends some data without needing to receive any messages ?
I want just connecting my client and starting to receive data periodically without sending messages.
Auro.
How to write a websocket server without receive any packet from client after handshake
-
- Posts: 4
- Joined: Thu Sep 21, 2023 2:51 pm
Re: How to write a websocket server without receive any packet from client after handshake
A websocket is a bidirectional communication. As long as the socket is open you can send data at any time. The example you've linked even does that by using the function.
Code: Select all
ws_async_send
-
- Posts: 4
- Joined: Thu Sep 21, 2023 2:51 pm
Re: How to write a websocket server without receive any packet from client after handshake
Thank you for response.
I changed the implementation to an infinite loop within the websocket's http handler, to keep sending the packets. Like a default tcp server. Its works fine, but during the loop execution, all other http requests that are on my server are not answered.
Is there any way to send packets periodically without blocking new http calls during this process?
I changed the implementation to an infinite loop within the websocket's http handler, to keep sending the packets. Like a default tcp server. Its works fine, but during the loop execution, all other http requests that are on my server are not answered.
Is there any way to send packets periodically without blocking new http calls during this process?
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 255 guests