How to do it...

Let us create a simple messenger by performing the following steps:

  1. First, convert ch12-websocket to the Spring Boot 2.0 application by to pom.xml the Spring Boot 2.0.0.M2 starter POM dependencies, such as Spring WebFlux for Reactive components and Spring Boot actuator for project status monitoring and management.
  2. To add support for the websocket protocol, add the following starter POM dependency in pom.xml:
<dependency> 
   <groupId>org.springframework.boot</groupId> 
   <artifactId>spring-boot-starter-websocket</artifactId> 
</dependency> 
  1. To convert message payloads in JSON format to Java objects, add the following additional Maven dependency:
<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> ...

Get Spring 5.0 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.