I'll create a simple Socket.IO chat system with a CLI interface. This will have a server and a command-line client where multiple users can join and chat.
Setup
Create a new directory and initialize the project:
Multiple Users: Multiple CLI clients can connect simultaneously
Real-time Messaging: Messages appear instantly across all connected clients
User Count: Shows how many users are online
Simple Commands: Type messages and press Enter, type "exit" to quit
User IDs: Each user gets a short ID for identification
Timestamps: All messages show when they were sent
Example Usage
Terminal 1 (Server):
code
Socket server running on http://localhost:3000
Waiting for connections...
User connected: abc123def456
User connected: def456ghi789
[2:30:15 PM] abc123: Hello everyone!
[2:30:22 PM] def456: Hi there!
Terminal 2 (Client 1):
code
🟢 Connected to chat server!
Your ID: abc123
Type your messages and press Enter to send
Type "exit" to quit
👥 Users online: 2
> Hello everyone!
[2:30:15 PM] You: Hello everyone!
[2:30:22 PM] def456: Hi there!
>
Terminal 3 (Client 2):
code
🟢 Connected to chat server!
Your ID: def456
Type your messages and press Enter to send
Type "exit" to quit
👥 Users online: 2
[2:30:15 PM] abc123: Hello everyone!
> Hi there!
[2:30:22 PM] You: Hi there!
>
This creates a simple but functional chat system where anyone can join and start chatting immediately without any authentication!