Real Time Event Streaming with Spring Webflux
This commit is contained in:
parent
945932fa1d
commit
f95092d90a
@ -10,12 +10,14 @@ import org.springframework.web.reactive.socket.client.WebSocketClient;
|
|||||||
|
|
||||||
public class EventWebSocketClient {
|
public class EventWebSocketClient {
|
||||||
|
|
||||||
|
private static final String REMOTE_URL = "ws://localhost:8080/events";
|
||||||
|
|
||||||
public static void main(String[] args) throws URISyntaxException {
|
public static void main(String[] args) throws URISyntaxException {
|
||||||
|
|
||||||
WebSocketClient client = new ReactorNettyWebSocketClient();
|
WebSocketClient client = new ReactorNettyWebSocketClient();
|
||||||
|
|
||||||
client.execute(
|
client.execute(
|
||||||
URI.create("ws://localhost:8080/events"),
|
URI.create(REMOTE_URL),
|
||||||
session -> session.receive()
|
session -> session.receive()
|
||||||
.map(WebSocketMessage::getPayloadAsText)
|
.map(WebSocketMessage::getPayloadAsText)
|
||||||
.log().then())
|
.log().then())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user