-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[💫 Feature Request ] Allow SSE to use POST /w payload #139
Comments
Hey,
I would theoretically agree with you as the HTML standard doesn't define which HTTP method should be used, but for us, standard API users, there actually is a technical reason here : we can't specify which method the EventSource should use, it's simply not a configurable property at all unfortunately :/ The SSE extension uses the standard SSE implementation, while the one you linked states itself at its beginning:
So it's a replacement, a workaround, and not using the standard SSE implementation at all. So, if you are interested, feel free to dive into making an extension for this SSE polyfill, and submit it in our community extensions list |
If it walks like a duck and quacks like a duck? It says, it's a drop-in replacement for EventSource with additional functionality. Meaning it will default to expected protocol behaviour if no additional information is configured. All it takes is:
I'd agree with you for another extension. But are you sure it's needed? |
I liked the metaphor, though we'll be sticking to standards here! After looking a bit more into it, you're right, I don't think it needs a separate extension. |
I'm a standard's man myself. Just don't mind standard (+ additional feature if it makes sense.). @Telroshan I'm confused. Do you think it should be a separate extension or this makes sense now? PS: If you're implying I replace the EventSource globally for Could you give me an example of the |
Sorry for the confusion @XChikuX ! To be clear, I think that:
This is not htmx related, it's simply the second parameter of the EventSource constructor, that the In terms of implementation for #132 , I imagine the SSE extension firing a CustomEvent, to let the user intercept it and modify the properties of a say Hope this makes it clearer! |
There is no technical reason to prevent SSE from sending a POST request or limiting the API to be payload-less
This issue is a very modest request to allow more advanced payloads for SSE.
I looked for existing implimentations and found This
I've already integrated it as an EventSource drop-in replacement to SSE and it works great.
Upon adding a payload (namely a captcha) and making it a POST request, everything works as expected and is very stable.
Would it be possible to integrate htmx 2.0 SSE extention with this solution?
Check https://dbounce.me (Bulk verification) for a working example.
The text was updated successfully, but these errors were encountered: