Open gudvinr opened 5 months ago
Hello @gudvinr,
Sorry for the late reply.
I'm not entirely clear on your specific requirements. Could you please elaborate in more detail?
I suggest providing some dummy code/patch file for the change you're asking for OR creating a PR where we can discuss it further and, if useful, we will merge it.
I'm not entirely clear on your specific requirements. Could you please elaborate in more detail?
Easiest to understand would be concept of server-sent events. In browsers, it is implemented by EventSource API.
Basically, it is one-way stream (server to client) of events.
In contrast to WebSocket, you don't need extra Upgrade flow and other stuff. It's basically what people call "long polling", but it doesn't finish after first reply.
Hello @gudvinr
We are already working on adding support for Server-Sent Events (SSE) in ESP-IDF, and the process is well underway. A Merge Request (MR) has already been raised to integrate SSE support along with a corresponding example.
For your convenience, I’ve attached the relevant patch file. Could you please review it and let us know if it meets your requirements? If you have additional expectations or specific needs, we’d be happy to discuss them further to ensure we align closely with your goals.
Thank you, and we look forward to your feedback.
In this patch I only see examples section so it's hard to say.
For my use-case there's no need for SSE specifically.
Basically I want to stream raw data from ESP and receive using e.g. readable stream API.
SSE is text-based protocol and I want binary data. But it's similar enough to what I want, so I used it as an example.
Is your feature request related to a problem?
When you want to create simplex S2C connection (for example, to use with SSE), you will need to construct the whole response preamble by hand.
httpd_send
/httpd_send_all
httpd_resp_send_chunk
Transfer-Encoding: chunked
. This adds payload which might be undesirable to the protocol (whatwg warns that chunking might lead to issues when using SSE specifically).Describe the solution you'd like.
Add a method to send only http preamble consists of status line and headers without sending body and closing connection.
This method can be used by:
httpd_resp_send
httpd_resp_send_chunk
(that might just callhttpd_resp_set_hdr(r, "Transfer-Encoding", "chunked")
before calling method)httpd_send
/httpd_send_all
Describe alternatives you've considered.
No response
Additional context.
No response