-
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
SSE extension: Add the ability to send data to the endpoint before the connecction is being made similar to htmx:configRequest or htmx:wsConfigSend #132
Comments
Hey, about this specifix example, I'm unsure what your setup is, but your cookies should be naturally sent along the SSE connection request by your browser. I don't see any reason to oppose to making the connection request configurable with an event though, so if you are interested, feel free to dive into that and submit a PR! (Moved this to the extensions repo btw) |
@Telroshan I'd love to help. Where do I start? Essentially need to connect hx-vals to payload in sse.js (3rd party script) and allow POST. Similar Issue: #139 |
I read the source code, couldn't understand it because it's split into 2 repos, so I need to understand htmx first then sse, and it's not how I write js. Didn't find any other extension that uses htmx:configRequest to follow the implementation. Will retry later |
@XChikuX the EventSource is instantiated here in the extension: htmx-extensions/src/sse/sse.js Lines 76 to 78 in c387c0d
I'm thinking we could fire an event right before this call, like the extension already does at other places using htmx's Hope this helps! |
I have many users, each user has his own cookie identifier, I need to send to the SSE endpoint in order for the server to perform the right action, on the data belonging to the correct user.
In HTMX I can do this
I can do the same via was extension via the
htmx:wsConfigSend
event, but in sse, there's no such events and I can't pass data via the headers, I'm forced to append the cookie to the sse URL via javascript and that's so dirty, like soI would be great to be able to pass data via the headers and have more control like the standard htmx and websockets extension
The text was updated successfully, but these errors were encountered: