m-cakir / chat-example

A simple chat demo using multiple Socket.IO servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chat Example

A simple chat demo using multiple Socket.IO servers

Features

  • Multiple users can join by entering an username on website load
  • Users can type chat messages

Built with

Redis Cluster

Traefik

Server

Web

Environment Variables

Server

Variable Default Type Desc Example
DEBUG --- string node.js debugging utility socket.io:server*
NODE_ENV development string can be "production" or "development" or "test" development
PORT 3001 number server/listening port 3001
REDIS_HOSTS --- json array as string redis cluster host/port list '[{"host":"localhost","port":6101}]'
REDIS_PASSWORD --- string redis cluster password pwd
HOSTNAME APP_DEFAULT string OS or Container hostname MY_PC
CORS_ORIGIN http://localhost:3000 string web app url http://localhost:3000

Web

Variable Default Type Desc Example
REACT_APP_SOCKET_ENDPOINT --- string socket server endpoint http://localhost:3001

How to use

$ docker-compose up --scale socket-server=3 -d

It starts Redis cluster, Traefik for reverse-proxy, web app and 3 socket.io servers.

And point your browser to http://localhost:3000.

Screenshot

About

A simple chat demo using multiple Socket.IO servers


Languages

Language:JavaScript 82.9%Language:HTML 12.1%Language:CSS 3.3%Language:Dockerfile 1.7%