/chat-server-gg

Basics of WebSocket Scaling

Primary LanguageJavaScript

chat-server-gg

Deploy

This project aims to demonstrate the basics of scaleable WebSocket (and|or) REST servers.


Technology

Terms

  • Message: An Object that is produced or consumed by messaging passing services such as WebSocket, MessageQueue, Pub/Sub or REST
  • Publish/Subscribe (Pub/Sub): Messaging pattern where "senders of Messages" (aka Publishers) have no knowledge of "specific Message receivers" (aka Subscribers)
  • Message Queue (MQ): Sibling of the Pub/Sub pattern, used when Subscribers and Publishers do not need to interact simultaneously with the MQ. This means Messages are placed into a Queue to be processed by receiving parties at a later time
  • Message Broker: is an intermediary computer program module that translates a message from the formal messaging protocol of the sender to the formal messaging protocol of the receiver.
  • Queue/Job Worker: Application that preforms tasks like Batch Processing of Messages in a MessageQueue. Often combined with Job Scheduling or a Job Scheduler

Message Broker Logic

  • All Messages are sent to the Publisher and MQ.
  • All Brokers emit Subscription Messages to Clients.
  • All Workers will store Queued Messages in Couchdb

[The Following is a Work in Progress]

Docker

Working in containers is much more efficient than a few stand-alone VPS.

# Init Swarm if not already configured
docker swarm init

docker stack deploy -c docker-compose.yml wss

Vagrant VPS Mock

This will deploy multiple instances to your local Vitualbox Provider similar to how it should be deployed in production.

Requirements:

# To suppress auth popups follow: 
# https://github.com/agiledivider/vagrant-hostsupdater#suppressing-prompts-for-elevating-privileges
vagrant up