From f6c54f4c7c4df613afee97188444a285ff7bfdc4 Mon Sep 17 00:00:00 2001 From: Martin Ocenas Date: Thu, 27 Jul 2023 14:06:04 +0200 Subject: [PATCH] Fix join message in websocket quickstart There should be a "joined" message on user joining, but no message is acctually sent. No "ready" message is generated on user joining, so move this message to user incoming. --- docs/src/main/asciidoc/websockets.adoc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/src/main/asciidoc/websockets.adoc b/docs/src/main/asciidoc/websockets.adoc index 37a07e7854e27..c353e7fede45c 100644 --- a/docs/src/main/asciidoc/websockets.adoc +++ b/docs/src/main/asciidoc/websockets.adoc @@ -95,6 +95,7 @@ public class ChatSocket { @OnOpen public void onOpen(Session session, @PathParam("username") String username) { + broadcast("User " + username + " joined"); sessions.put(username, session); } @@ -112,11 +113,7 @@ public class ChatSocket { @OnMessage public void onMessage(String message, @PathParam("username") String username) { - if (message.equalsIgnoreCase("_ready_")) { - broadcast("User " + username + " joined"); - } else { - broadcast(">> " + username + ": " + message); - } + broadcast(">> " + username + ": " + message); } private void broadcast(String message) {