Does anyone know about reqwest's EventSource?
I'm using reqwest-eventsource crate to send a POST request to a website and receive the corresponding stream.
However, I've encountered an issue:
When I use reqwest's post API (awaiting for the server to send complete information), the received messages are completely normal. But when using this library, each sent event gets stuck at line 288 until the server terminates the connection.
My code is no different from the official sample code, except that I need to use POST to fulfill my requirements.
At the same time, I confirm that my code works fine when connecting to the local actix-web SSE service.
Here is my modified version of the log.
And here is the corresponding output information.
Does anyone know how to troubleshoot this issue?
I'm not an expert on SSE, but the standard apparently doesn't support POST requests, e.g. see this:
That doesn't mean a hack couldn't be made to get POST working somehow, but if it's not part of the standard, then I guess this isn't really a bug in the reqwest-eventsource crate, and you might have to work out some kind of hacky fix yourself. If the JS interface that you say works properly uses GET instead of POST, it might be better to emulate that.
In fact, it seems that the web pages related to ChatGPT are using the POST method to use EventSource, so I'm not sure where the problem might be.
This is also what I want to ask. I want to pinpoint the specific location of the issue, but so far I haven't found any way to try troubleshooting. Therefore, I hope to find a reliable way to identify the problem or if there are other ways to use this API.