Skip to content
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: Swap HTML on Server Sent Events (like WebSockets) improved version #185

Closed
wants to merge 11 commits into from
Closed

FEATURE: Swap HTML on Server Sent Events (like WebSockets) improved version #185

wants to merge 11 commits into from

Commits on Aug 15, 2020

  1. Rewriting hx-sse interface

    First pass at making a new SSE interface.
    
    SUPPORTS:
    - New syntax `<div hx-sse="/url EventName" hx-swap="outerHTML" hx-target="somewhere">`
    
    DOES NOT SUPPORT:
    - triggers. Original syntax has been removed.
    - unnamed events (can't make onmessage work)
    - connection pooling (required before use)
    - extra parameters on hx-swap, like: swap, settle, scroll, show (this should *probably* be implemented before use)
    benpate committed Aug 15, 2020
    Configuration menu
    Copy the full SHA
    89ca328 View commit details
    Browse the repository at this point in the history
  2. Update htmx.js

    This may match the spec: https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events-intro
    ```
    The default event type is "message".
    ```
    tomberek committed Aug 15, 2020
    Configuration menu
    Copy the full SHA
    4047494 View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2020

  1. Merge pull request #1 from tomberek/patch-1

    Adding default “message” eventType if none is specified.  This matches the specifications Tom provided from the WHATWG.
    benpate committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    25db559 View commit details
    Browse the repository at this point in the history
  2. Support multiple listeners on a single EventSource

    Following through on part 1 of #155 (comment)
    benpate committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    d319161 View commit details
    Browse the repository at this point in the history
  3. First pas at EventSource pooling

    - "works" with limited testing.
    - Adding/Removing EventSources to/from the pool works correctly.
    - Events coming through to page correctly.
    - Much testing, cleanup, and code style needed.
    - Haven't yet tested multiple SSEs on a single page.
    benpate committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    aab9c25 View commit details
    Browse the repository at this point in the history
  4. Removing debugging statements

    benpate committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    7c7e4eb View commit details
    Browse the repository at this point in the history
  5. Connection Pooling 2.0

    This is a first draft of a better kind of connection pooling.  Since the number of connections is unlikely to grow very large, it seems easier and more efficient to just put them all into one array, and scan through it whenever we need.
    
    This enables a new function `auditEventListeners` which verifies that the (probably < 4) remote connections are still supporting active DOM nodes, and saves us the extra work of walking an entire sub-tree hunting for them.
    
    I think this same structure could save us even more work if applied to WebSockets, too.  But, that effort should wait until we've confirmed that we like this for SSE.
    benpate committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    52250d9 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2020

  1. Bug fixes

    - rewriting connection sharing to use a single array instead of a more complicated map of urls/connections.
    benpate committed Aug 17, 2020
    Configuration menu
    Copy the full SHA
    f792295 View commit details
    Browse the repository at this point in the history
  2. Initial test using Tom's doSwap function

    This is much more comprehensive than my original `handleContent` function.
    
    Still more work required to verify that this is handling all of the features we need, and then backport it into WebSocket handlers and AJAX handlers.
    benpate committed Aug 17, 2020
    Configuration menu
    Copy the full SHA
    5b9c471 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2020

  1. Adding Test Cases

    Sorry these are all manual cases.  If someone has suggestions on how to make these automated, I'm happy to improve them.
    benpate committed Sep 4, 2020
    Configuration menu
    Copy the full SHA
    f10bbe2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    02a7235 View commit details
    Browse the repository at this point in the history