Skip to content

Commit 41080d0

Browse files
authored
fix: forward messages asynchronously in Vite websocket proxy (#15747)
Prevents deadlocks in Quarkus environments. Fixes #15744
1 parent 3951cce commit 41080d0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

vaadin-dev-server/src/main/java/com/vaadin/base/devserver/viteproxy/ViteWebsocketProxy.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ public class ViteWebsocketProxy implements MessageHandler.Whole<String> {
5252
public ViteWebsocketProxy(Session browserSession, Integer vitePort)
5353
throws InterruptedException, ExecutionException {
5454
viteConnection = new ViteWebsocketConnection(vitePort,
55-
browserSession.getNegotiatedSubprotocol(), msg -> {
56-
try {
57-
browserSession.getBasicRemote().sendText(msg);
58-
getLogger().debug("Message sent to browser: " + msg);
59-
} catch (Exception e) {
55+
browserSession.getNegotiatedSubprotocol(),
56+
msg -> browserSession.getAsyncRemote().sendText(msg, result -> {
57+
if (result.isOK()) {
58+
getLogger().debug("Message sent to browser: {}", msg);
59+
} else {
6060
getLogger().debug("Error sending message to browser",
61-
e);
61+
result.getException());
6262
}
63-
}, () -> {
63+
}), () -> {
6464
try {
6565
browserSession.close();
6666
} catch (IOException e) {

0 commit comments

Comments
 (0)