This project explores how Redis Pub/Sub can be used to implement a real-time chat system using WebSockets. It mimics a real-world chat room where messages are published to a Redis channel and received by subscribed clients.
-
WebSocket-based real-time messaging
-
Redis Pub/Sub for message broadcasting
-
Multiple users can join the same chat room
-
Echo framework for handling WebSocket connections
-
Use a redis instance, better to use a docker container, download
docker
first. -
Pull the redis image from dockerhub
docker pull redis
-
Start the redis container
docker run --name redis-container -p 6379:6379 -d redis
for each consecutive use
docker start redis-container
-
If you want to use the Redis-CLI
docker exec -it redis-container redis-cli
-
Clone the project
git clone https://github.com/Sahil2k07/Redis-Pub-Sub.git
-
Change Directory
cd Redis-Pub-Sub
-
Get all the packages
go mod download
-
Get the vendor ( optional )
go mod vendor
-
Start the project
go run .