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

Send message to all connected web socket clients fix #645 #680

Merged
merged 1 commit into from
Mar 21, 2017
Merged

Conversation

jknack
Copy link
Member

@jknack jknack commented Mar 20, 2017

No description provided.

* @param err An err callback.
* @throws Exception If something goes wrong.
*/
void broadcast(final Object data, final SuccessCallback success, final OnError err)
Copy link
Member

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) {
Copy link
Member

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?

Copy link
Member

@krisztiankocsis krisztiankocsis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments.

Copy link
Member

@krisztiankocsis krisztiankocsis left a 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.

@jknack
Copy link
Member Author

jknack commented Mar 21, 2017

@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.

@jknack jknack merged commit 08c255a into master Mar 21, 2017
@jknack jknack deleted the 645 branch June 4, 2017 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants