KOSUNI KOREA
Korean News in English
Technology

[Node.JS Tutorial] Displaying Real-Time Online User List

Published October 16, 2026 · 1 views
[Node.JS Tutorial] Displaying Real-Time Online User List

Welcome.

Last time, we implemented a feature that shows real-time notifications when users join or leave a chat room.

Now that we can check if users are connected, we still don't know how many people are currently online or who exactly is connected.

In this lesson, we'll create a real-time user list feature to display this information.


Why You Need an Online User List

Most messaging apps show you who's currently online.

For example:

  • Internal company messengers

  • Discord

  • Slack

  • Game chat systems

  • Online courses

These services always display active users.

This helps users quickly identify who they can message.


How to Manage the User List

The server already manages user information.

Each user has:

  • Socket ID

  • Nickname

  • Connection status

This lesson will manage these details as a single list and send it to browsers.


Storing the User List

When users connect, the server stores their information.

For example:

Chul-su

Yong-hee

Min-soo

The server can manage active users as an array or object.

Add users when they join, and remove them when they leave.


Sending the List to All Users

When someone joins or leaves, the user list changes.

The updated list must be sent to all currently connected users.

This ensures every browser shows the same user list at all times.

With Socket.IO, this is easy to implement.


Displaying the List in Browsers

Browsers display the user list received from the server.

For example:

Current Users

● Chul-su

● Yong-hee

● Min-soo

This makes it easy to see who's online.


Displaying Online Count

Showing both usernames and the total number of active users is more helpful.

For example:

Current Users

3 people

This lets you quickly see how many people are in the chat room.

This feature is easy to implement using the user list.


Automatic Real-Time Updates

The user list should update automatically without refreshing the page.

For example:

When Chul-su joins, it shows:

Current Users

Chul-su

Then when Yong-hee joins, it updates to:

Current Users

Chul-su

Yong-hee

If someone leaves, their name disappears immediately.


Showing Online Status

Real messaging apps don't just show names—they display status too:

  • Online

  • Offline

  • Away

  • Typing

This project will initially manage only online status, but you can later add more statuses.


Designing the User List Display

User lists are typically placed on one side of the screen.

For example:

  • Right sidebar

  • Left menu

  • Top user area

This project will place a simple list next to the chat window for easy viewing.


Potential Future Uses

The user list we're building today can be used in many future features:

  • Selecting users for private messages

  • Showing chat room member count

  • Admin functions

  • User blocking

  • Displaying profiles

  • Friend lists

Most of these features rely on knowing who's currently online.


Performance Considerations

As more users join, the list grows larger.

In real services, they:

  • Send only changed data

  • Reduce unnecessary events

  • Minimize user information sent

To reduce server load. This is a learning project, so we'll send the full list for simplicity, but real-world implementations would use these optimizations.


Lesson Summary

This lesson showed how to implement a real-time online user list for chat applications.

We also understood how the list automatically updates when users join or leave.

User list management is crucial in real-time chat services and forms the foundation for many future features.


Next Lesson Preview

In the next lesson, we'll implement multiple chat room (Room) functionality.

We'll create multiple rooms where users can join different channels to chat, making our service more similar to real messaging apps.

FAQ

Why is a real-time user list important?

It helps users quickly identify who they can message and see chat room activity at a glance.

How does the user list update without refreshing?

The server sends updates to all connected clients whenever someone joins or leaves, using Socket.IO for efficient real-time communication.

Korean Source

This article is an English localization of a Korean-language report from BlogScore. Original: [Node.JS 강좌] 8강 현재 접속자 목록 실시간 표시하기