-
-
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 fix #645 #680
Conversation
* @param err An err callback. | ||
* @throws Exception If something goes wrong. | ||
*/ | ||
void broadcast(final Object data, final SuccessCallback success, final OnError err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final on interface method that are not default makes no sense since they do not affect the actual implementation.
@@ -143,6 +152,14 @@ public boolean isOpen() { | |||
} | |||
|
|||
@Override | |||
public void broadcast(final Object data, final SuccessCallback success, final OnError err) | |||
throws Exception { | |||
for (WebSocket ws : sessions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The broadcast terminates on the first error. Wouldn't it be better to try to send to all endpoint, log the exception and throw a new one if there was at least one failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my two recommendations.
@krisztiankocsis thank you, I update the pull with your comments. You're right about broadcast error, but I didn't rethrow anything. Instead, I used the error callback to notify about a possible error. |
No description provided.