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

Web Sockets & Server Sent Events #596

Open
name256a opened this issue Aug 14, 2024 · 1 comment
Open

Web Sockets & Server Sent Events #596

name256a opened this issue Aug 14, 2024 · 1 comment

Comments

@name256a
Copy link

Good day,

Do you have any example that illustrates how the above can be developed using the framework?

Regards

@svenkubiak
Copy link
Owner

Sorry for the late reply. While there is no support for Web Sockets, usage of ServerSentEvent on the server side is quite easy.

Setup your SSE URL in initializeRoutes() in the Bootstrap class, e.g.

...
Bind.serverSentEvent().to("/mysse");
...

Then send data to your SSE endpoint using the ServerSentEventManager at any point in your application.

...
private final ServerSentEventManager sse;
...
sse.send("/sse", "myData");
...

Everything else is handled on the client side, e.g.

https://www.w3schools.com/html/html5_serversentevents.asp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants