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"> 
        Greetings! 
        <br/> 
        <textarea id="chatDisplay" rows="10" cols="80" 
              disabled="true"></textarea> 
        <br/> 
        <input id="chatInput" type="text" style="width: 500px" 
              value="" /> 
        <br/> 
        <button id="chatButton">Send</button> 
        <br/> 
    </div> 

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

  • A simple greeting.
  • An HTML ...

Get Learning Spring Boot 2.0 - Second Edition 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.