Test the First Socket Connection
Start the backend:
npm run dev
Open the application in your browser:
http://localhost:3000
Open the browser developer tools and navigate to the Console tab.
You should see a message similar to:
Connected to server: abc123...
In the backend terminal, you should also see the server-side connection log if you have registered the connection handler.
To test multiple connections:
- Open the application in Chrome.
- Open another browser tab.
- Open the same application in a different browser.
- Check the backend terminal.
You should see a new connection log for each browser connection.
Use multiple browser windows or an incognito window to simulate multiple clients. Each browser tab generally establishes its own Socket.IO connection.
The browser successfully connects to the Socket.IO server.
Each connection receives its own socket ID.
Multiple browser windows can be used to test real-time communication.