https://github.com/parvvaresh/chatapp
A simple TCP chat application built in Go.
https://github.com/parvvaresh/chatapp
go websocket
Last synced: 30 days ago
JSON representation
A simple TCP chat application built in Go.
- Host: GitHub
- URL: https://github.com/parvvaresh/chatapp
- Owner: parvvaresh
- Created: 2023-11-01T15:05:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-09-05T11:42:10.000Z (2 months ago)
- Last Synced: 2025-09-23T12:49:40.599Z (about 1 month ago)
- Topics: go, websocket
- Language: Go
- Homepage:
- Size: 19.7 MB
- Stars: 16
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TCP Chat Application
A simple TCP chat application built in Go. The project includes a server and client programs, which allow multiple users to connect and chat in real-time. The project also provides Docker and Docker Compose setup for easy deployment and testing.
---
## Features
* TCP-based chat server and client
* Support for multiple clients simultaneously
* Dockerized server and clients for easy deployment
* Can be extended to WebSocket support or custom features
---
## Project Structure
```
tcp-chat/
├── server.go # Server source code
├── client.go # Client source code
├── Dockerfile # Dockerfile to build server and client images
├── docker-compose.yml # Compose file to run server and multiple clients
├── go.mod # Go module file
├── go.sum # Checksums for dependencies
└── README.md # Project documentation
```
---
## Prerequisites
* Go 1.21 or later
* Docker (for containerized setup)
* Docker Compose (for running multiple services)
---
## Running Locally
### 1. Build and run the server manually
```bash
# Build server binary
go build -o chat-server ./server.go
# Run server
./chat-server
```
### 2. Build and run the client manually
```bash
# Build client binary
go build -o chat-client ./client.go
# Run client (can run multiple instances)
./chat-client
```
---
## Running with Docker
### 1. Build Docker images
```bash
docker-compose build
```
### 2. Run server and clients
```bash
docker-compose up
```
* The server will start listening on port 8080.
* Clients will connect automatically.
* You can open multiple terminal sessions to interact with different clients.
### 3. Stop containers
```bash
docker-compose down
```
---
## CI/CD with GitHub Actions
* The project includes a GitHub Actions workflow to:
* Build Go binaries
* Run tests
* Build Docker images
* Optional: push Docker images and deploy
---
## Extending the Project
* Add username support for clients
* Upgrade to WebSocket for browser-based chat
* Add logging or message persistence
---
## License
This project is licensed under the MIT License.