Real Time Event Streaming with Spring Webflux

This commit is contained in:
Chirag Dewan 2018-07-23 21:10:03 +05:30
parent 945932fa1d
commit f95092d90a

View File

@ -10,12 +10,14 @@ import org.springframework.web.reactive.socket.client.WebSocketClient;
public class EventWebSocketClient {
private static final String REMOTE_URL = "ws://localhost:8080/events";
public static void main(String[] args) throws URISyntaxException {
WebSocketClient client = new ReactorNettyWebSocketClient();
client.execute(
URI.create("ws://localhost:8080/events"),
URI.create(REMOTE_URL),
session -> session.receive()
.map(WebSocketMessage::getPayloadAsText)
.log().then())