SSE listen
I made a little and slightly hacky change to support my SSE use-case. I'm not suggesting that this PR be merged... it's really just here for discussion.
Record of the conversation from Discord:- [3:19 PM] wtpayne: Let me give the rationale. [3:19 PM] wtpayne: So ... I've got a dashboard builder. [3:19 PM] wtpayne: The dashboard components themselves can be dynamically added, removed and modified. [3:19 PM] wtpayne: For this, sse:swap is perfect. [3:20 PM] wtpayne: But I also want the dashboard components to display oscilloscope-like graphs... [3:20 PM] wtpayne: And for the data for the graph to come over as JSON, so I can use D3.js to do the plotting. [3:21 PM] wtpayne: So I have some situations where I want to do things the HTMX way ... and have a bit of HTML swapping in. [3:21 PM] wtpayne: And other situations where I want to do things differently, and have JSON coming in over SSE and being used to update a chart or other visualization with D3.js... [3:22 PM] wtpayne: So I need to be able to say 'do something with the content of this SSE event ... but don't swap it into the DOM'
please retarget to
devbranch as well, thank you for working on this!
Retargeted to 'dev' branch as requested.
Added tests, and checked that tests pass.
What's the status of this pull request? Is it ready for review?
I think so. I've been using it like this without too many issue so far.
On Sat, 2 Jan 2021, 00:05 1cg, [email protected] wrote:
What's the status of this pull request? Is it ready for review?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/bigskysoftware/htmx/pull/263#issuecomment-753406999, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ53A3KDWRPZWMQWM7URSDSXZPLXANCNFSM4UYIFLDA .
However... I did make a fix for what appeared to me to be a bug ... Settle wasn't being triggered, so I added it in. It seems to work, but I'm not sure 100% if it's the right thing to do.
On Sat, 2 Jan 2021, 02:15 William Payne, [email protected] wrote:
I think so. I've been using it like this without too many issue so far.
On Sat, 2 Jan 2021, 00:05 1cg, [email protected] wrote:
What's the status of this pull request? Is it ready for review?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/bigskysoftware/htmx/pull/263#issuecomment-753406999, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ53A3KDWRPZWMQWM7URSDSXZPLXANCNFSM4UYIFLDA .
@benpate - I have a separate callback for each type of SSE event, and it would be exceedingly difficult to merge them together. (The callbacks are themselves transmitted over SSE) so my very strong preference would be to leave the SSE event name in the DOM event name if at all possible.
resurrecting this thread: @benpate just pulled sse out to a separate extension and I'd like to revist this change in that context
It looks like this is stalled out. It in the time since, Server-Side Events have been pulled out to an extension. If the current SSE extension still has the issue, feel free to either re-open this PR or make a new one and we'll get it looked at ASAP.