https://github.com/yusufff/socketio-cluster-nginx
https://github.com/yusufff/socketio-cluster-nginx
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yusufff/socketio-cluster-nginx
- Owner: yusufff
- Created: 2020-04-14T13:42:14.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-25T21:01:22.000Z (about 1 year ago)
- Last Synced: 2025-01-24T19:41:48.695Z (4 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Socket.IO Chat with nginx & redis
A simple chat demo for socket.io
## How to use
Install [Docker Compose](https://docs.docker.com/compose/install/), then:
```
$ docker-compose up -d
```And then point your browser to `http://localhost:3000`.
This will start four Socket.IO nodes, behind a nginx proxy which will loadbalance the requests (using the IP of the client, see [ip_hash](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#ip_hash)).
Each node connects to the redis backend, which will enable to broadcast to every client, no matter which node it is currently connected to.
```
# you can kill a given node, the client should reconnect to another node
$ docker-compose stop server-george
```## Features
- Multiple users can join a chat room by each entering a unique username
on website load.
- Users can type chat messages to the chat room.
- A notification is sent to all users when a user joins or leaves
the chatroom.