October 2018
Intermediate to advanced
982 pages
23h 29m
English
In this chapter, we haven't yet picked up security. That will be covered in Chapter 18, Securing Your App with Spring Boot. For now, we need something to take its place.
As a workaround, we can introduce the concept of the user entering his or her own username and sending it with the HTTP-based request used to create the WebSocket.
To offer the user a place to enter their username, we can put this at the top of the Thymeleaf template:
<input id="username" type="text" />
<button id="connect">Connect</button>
<button id="disconnect" style="display: none">Disconnect</button>
There is a both a Connect and a Disconnect button to analogously log in/log out of the WebSocket session.
Now we can wire it so ...
Read now
Unlock full access