How to do it...

Build a Socket.IO client application that will connect to a Socket.IO server you will build next. Include a form where the user can type a username and a password to attempt to log in. The Socket.IO client will only be able to connect to the /home namespace after the user is logged-in:

  1. Create a new file named io-express-cli.html
  2. Add the following HTML content:
      <!DOCTYPE html> 
      <html lang="en"> 
      <head> 
          <meta charset="UTF-8"> 
          <title>Socket.IO Client</title> 
          <script src="http://localhost:1337/socket.io/socket.io.js">            </script> 
          <script            src="https://unpkg.com/@babel/standalone/babel.min.js"> </script> </head> <body> <h1 id="title"></h1> <form id="loginForm"> <input type="text" name="username" placeholder="username"/> <input ...

Get MERN Quick Start Guide 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.