Build a Real-Time Chat Application with Node.js
Lesson 7 of 10 70% of course

Running the App & Testing in Two Tabs

13 · 5 min · 6/12/2026

Learn Running the App & Testing in Two Tabs in our free Build a Real-Time Chat Application with Node.js series. Step-by-step explanations, examples, and interview tips on Toolliyo Academy.

Sign in to track progress and bookmarks.

Running the App & Testing in Two Tabs
Lesson 7 of 10 · Part 3 — Run, Learn & Extend · Build a Real-Time Chat Application with Node.js
Course: Build a Real-Time Chat Application with Node.js · Lesson: 7/10 · Read time: ~15 min · Level: Beginner

Running the App & Testing in Two Tabs

You built all the pieces — now connect them. This lesson is hands-on: start the server, open two browser tabs, join the same room, and watch real-time magic happen.

Step 1 — Start the development server

In terminal, inside your chat-app folder:

npm run dev

Expected output:

Chat server running on http://localhost:3000
[nodemon] watching path(s): *.*
[nodemon] starting `node server.js`
💡 Tip: If port 3000 is busy, change const PORT = 3000 to 3001 in server.js and use http://localhost:3001.

Step 2 — Open the app in your browser

Navigate to:

http://localhost:3000

You should see the login screen — dark background, username and room inputs, Join button.

⚠️ Common Mistake: Opening public/index.html as a file (file:///...). Socket.IO requires HTTP — always use localhost through Express.

Step 3 — Two-tab test (the “wow” moment)

  1. Tab 1: Name = Alice, Room = general → Join Chat
  2. Tab 2: Name = Bob, Room = general → Join Chat
  3. In Tab 1, type “Hello from Alice!” and press Enter
  4. Tab 2 should show the message instantly without refresh
  5. Reply from Tab 2 — Tab 1 receives it immediately

What to verify

FeatureExpected behavior
Join messageBoth tabs show “Bob joined the room” (system text, centered)
Chat bubblesYour messages blue/right; others gray/left
TimestampsSmall time under each bubble (e.g. 2:45 PM)
Online usersHeader shows “Online (2) — Alice, Bob”
TypingStart typing in Tab 1 → Tab 2 shows “Alice is typing…”
DisconnectClose Tab 2 → Tab 1 shows “Bob left the room”

Step 4 — Test different rooms

Open Tab 3: join room random as Charlie. Messages in general should not appear in random. This proves Socket.IO rooms isolate conversations.

👨‍🏫 Teaching note: Make this a class activity: half the class joins #team-a, half joins #team-b. Shout “send hello” — only same-room students see it. Teaches rooms viscerally.

Debugging with browser DevTools

  1. Press F12Network tab
  2. Filter by WS (WebSocket)
  3. Click the socket.io connection → Messages
  4. Watch JSON frames fly when you send chat — great for demos

Server terminal logs

When tabs connect/disconnect, server prints:

A user connected: xK39f...
A user connected: pQ82a...
User disconnected: pQ82a...

If something does not work

  • Blank page → check Express static path and that files are in public/
  • Cannot connect → server running? Correct port?
  • Messages missing → compare event names in server.js and client.js character by character

Full troubleshooting table is in Lesson 10.

Celebrate 🎉

You built a working real-time chat application. Next we explain why it works — the Socket.IO deep dive.

Continue learning

Previous: Frontend JavaScript — Connect & Send Messages

Next: How Socket.IO Works — Deep Dive

Course home: All 10 lessons

Test your knowledge

Quizzes linked to this course—pass to earn certificates.

Browse all quizzes
Build a Real-Time Chat Application with Node.js

On this page

Step 1 — Start the development server Step 2 — Open the app in your browser Step 3 — Two-tab test (the “wow” moment) What to verify Step 4 — Test different rooms Debugging with browser DevTools Server terminal logs If something does not work Celebrate 🎉 Continue learning
Part 1 — Getting Started
Introduction — What We Are Building Project Setup — Folder, npm & Dependencies
Part 2 — Build the App
Building the Server — Express & Socket.IO Frontend HTML — Login Screen & Chat Layout Frontend CSS — Modern Chat UI Design Frontend JavaScript — Connect & Send Messages
Part 3 — Run, Learn & Extend
Running the App & Testing in Two Tabs How Socket.IO Works — Deep Dive
Part 4 — Ship It
Bonus Features — Typing, Online Users & Timestamps Deploy to Railway, Troubleshooting & Summary
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details