July 2018
Intermediate to advanced
268 pages
7h 36m
English
Spring WebFlux includes a reactive WebSocket client and server support based on the Java WebSocket API.
On the server, create WebSocketHandlerAdapter, and then map each of those handlers to the URL. Since we don't cover WebSocket in our sample application, let's go into a bit more detail:
public class MovieWebSocketHandler implements WebSocketHandler { @Override public Mono<Void> handle(WebSocketSession session) { // ... }}
The handle() method takes in the WebSocketSession object and returns Mono<Void> when the handling of session is complete. WebSocketSession handles inbound and outbound messages using the Flux<WebSocketMessage> receive() and Mono<Void> send(Publisher<WebSocketMessage>) methods, respectively.
In the web ...
Read now
Unlock full access