A lightweight TCP-based command-line group chat application built with Go, designed to demonstrate low-level networking, concurrency, and scalable client handling using goroutines and channels.
This project implements a multi-client chat server over raw TCP sockets. Users can connect via terminal clients, set usernames, join chat rooms, and exchange messages in real time. Each chat room is handled independently, ensuring smooth communication across multiple users simultaneously.
- TCP socket–based client-server architecture
- Command-driven interface
- Multiple chat rooms support
- Concurrent client handling using goroutines
- Channel-based message processing
- Lightweight and minimal dependencies
- Language: Go
- Networking: Native TCP sockets
- Concurrency: Goroutines & Channels
| Command | Description |
|---|---|
/nick <name> |
Set your username |
/join <room> |
Join or create a chat room |
/rooms |
List available chat rooms |
/msg <message> |
Send message to current room |
/quit |
Disconnect from server |
- The server listens for incoming TCP connections.
- Each connected client is handled in its own goroutine.
- Commands are parsed and processed via channels.
- Chat rooms maintain their own client lists.
- Messages are broadcast only to members of the same room.
- Go installed (v1.18+ recommended)
go run server.go