-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Send message to all connected web socket clients #645
Labels
Milestone
Comments
Correct, there is no way to do such thing today. But what you showed me should works. Go to your application do something like: public static final List<WebSocket> allWebsocketSessions = new CopyOnWriteArrayList<>();
{
ws("/ws", ws -> {
sessions.add(ws);
ws.onClose(() -> sessions.remove(ws));
});
} From your controller you can access to It is a (not that ugly) workaround. Let's keep this open and will find a way to do it automatically. |
Worked perfectly! Thanks! |
jknack
added a commit
that referenced
this issue
Mar 20, 2017
jknack
added a commit
that referenced
this issue
Mar 20, 2017
jknack
added a commit
that referenced
this issue
Mar 21, 2017
jknack
added a commit
that referenced
this issue
Mar 21, 2017
Send message to all connected web socket clients fix #645
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using Jooby's MVC routes for an API. I have also set up a websocket, to which a few clients connect. What I'm trying to do is send a message to all connected websocket clients whenever a specific http request is received in the server. This is how my route method looks like:
I've read jooby's documentation but can't figure out how to do it.
Thanks in advance.
The text was updated successfully, but these errors were encountered: