Now we are geared up to receive asynchronous messages from the server as comments are created, and display them dynamically on the site. However, there is something else that warrants attention.
Remember how, in the previous chapter, we had an HTML form for the user to fill out comments? The previous chapter's controller responded to such POSTs like this:
@PostMapping("/comments") public Mono<String> addComment(Mono<Comment> newComment) { /* stream comments to COMMENTS service */ return Mono.just("redirect:/"); }
redirect:/ is a Spring Web signal to re-render the page at / via an HTTP redirect. Since we are shifting into dynamically updating the page based on asynchronous WebSocket messages, this is no longer the best way.
What are the issues? A few can be listed as...