Skip to content

Discussion for SSE extension syntax #618

@benpate

Description

@benpate

We're moving SSE support into an extension (so it was decreed by @1cg). This thread is to collect suggestions/feedback on the syntax that we use in the new code. I'm just getting started now, so please let me know if I'm missing anything, or if there's something we should add. Now is the time :)

I think we should keep it as close to the existing syntax as possible, which should make it easier to migrate to the new code. Here's my first pass:

<div hx-ext="sse" sse-url="/my-first-event-source" sse-swap="message">
    INDIVIDUAL SUBSCRIPTION: I will be swapped whenever an unnamed message is received
</div>

<div hx-ext="sse" sse-url="/my-second-event-source" sse-swap="event1">
    INDIVIDUAL SUBSCRIPTION: I will be swapped whenever a message named "event1" is received
</div>

<div hx-ext="sse" sse-url="/my-third-event-source">
    SHARED SUBSCRIPTION:
    Nothing will happen to THIS div, but its children will listen to messages instead.

    <div hx-ext="sse" sse-swap="message">
        I will be swapped whenever an unnamed message is received
    </div>

    <div hx-ext="sse" sse-swap="event1">
        I will be swapped whenever a message named "event1" is received
    </div>

</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions