This project aims to demonstrate the basics of scaleable WebSocket (and|or) REST servers.
- uWebsocket.js for WebSockets and REST API
- Redis for Pub/Sub
- BullMQ for MessageQueue
- Couchdb for Storage.
- 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
- All Messages are sent to the Publisher and MQ.
- All Brokers emit Subscription Messages to Clients.
- All Workers will store Queued Messages in Couchdb
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
This will deploy multiple instances to your local Vitualbox Provider similar to how it should be deployed in production.
# To suppress auth popups follow:
# https://github.com/agiledivider/vagrant-hostsupdater#suppressing-prompts-for-elevating-privileges
vagrant up