diff --git a/springboot-webflux-8-websocket/src/main/java/org/spring/springboot/handler/EchoHandler.java b/springboot-webflux-8-websocket/src/main/java/org/spring/springboot/handler/EchoHandler.java index 8e36e59..a045582 100644 --- a/springboot-webflux-8-websocket/src/main/java/org/spring/springboot/handler/EchoHandler.java +++ b/springboot-webflux-8-websocket/src/main/java/org/spring/springboot/handler/EchoHandler.java @@ -12,6 +12,7 @@ public class EchoHandler implements WebSocketHandler { public Mono handle(final WebSocketSession session) { return session.send( session.receive() - .map(msg -> session.textMessage("服务端返回:小明, -> " + msg.getPayloadAsText()))); + .map(msg -> session.textMessage( + "服务端返回:小明, " + msg.getPayloadAsText()))); } } diff --git a/springboot-webflux-8-websocket/src/main/resources/websocket-client.html b/springboot-webflux-8-websocket/src/main/resources/websocket-client.html index 2f26cc2..ecbabad 100644 --- a/springboot-webflux-8-websocket/src/main/resources/websocket-client.html +++ b/springboot-webflux-8-websocket/src/main/resources/websocket-client.html @@ -6,22 +6,24 @@ -
+
+ diff --git a/springboot-webflux-8-websocket/src/test/java/WSClient.java b/springboot-webflux-8-websocket/src/test/java/WSClient.java index 0180132..ff5856e 100644 --- a/springboot-webflux-8-websocket/src/test/java/WSClient.java +++ b/springboot-webflux-8-websocket/src/test/java/WSClient.java @@ -7,6 +7,8 @@ import java.net.URI; import java.time.Duration; public class WSClient { + + public static void main(final String[] args) { final WebSocketClient client = new ReactorNettyWebSocketClient(); client.execute(URI.create("ws://localhost:8080/echo"), session ->