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

Support Server Side Events SSE #59

Open
neodigm opened this issue May 26, 2023 · 0 comments
Open

Support Server Side Events SSE #59

neodigm opened this issue May 26, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Comments

@neodigm
Copy link
Collaborator

neodigm commented May 26, 2023

Server Sent Events are a way for servers to send events to browsers. It provides a higher-level mechanism for communication between the server and the browser than websockets.

If you want an element to respond to a Server Sent Event via n55, you need to do two things:

Define an SSE source. To do this, add a n55-see attribute on a parent element with a connect declaration that specifies the URL from which Server Sent Events will be received.

Define elements that are descendants of this element that are triggered by server sent events using the n55-trigger="sse:<event_name>" syntax

Here is an example:

<section n55-sse="connect:/push_feed">
    <div n55-sse-trigger="sse:new_push" n55-sse-get="/push"></div>
</section>
@neodigm neodigm added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant