Introducing user chatting

What social media platform doesn't provide a means for users to communicate with each other? In this section, we'll enhance our application to allow chatting between users. This is another way to use asynchronous WebSocket messaging between clients and servers.

To start, let's add a new HTML element at the bottom of our template like this:

    <div id="chatBox"> 
        <textarea id="chatDisplay" rows="10" cols="80" 
        <input id="chatInput" type="text" style="width: 500px" 
              value="" /> 
        <button id="chatButton">Send</button> 

This preceding HTML code is placed right underneath the Upload widget for sending new pictures. It contains:

  • A simple greeting.
  • An HTML ...

Get Developing Java Applications with Spring and Spring Boot now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.