Publisher-Subscriber pattern demo using Node and WebSockets.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
public
.gitignore
README.md
index.js
package-lock.json
package.json
pubsub.js

README.md

PubSub

About

This simple app demonstrate PubSub pattern using Node/WS/Express server and WebSocket client APIs.

Usage

  1. Run server.
npm install
node index.js
  1. Open subscriber (sub.html). You can open multiple subscribers. Select desired channel and click Subscribe.
  2. Open publisher (pub.html). Input desired channel and message to publish. Click Publish.
  3. All the subscribers subscribed to given channel will recieve the message.
  4. To close the server just press Ctrl+C in terminal.

Todos

  • Allow pub/sub simultaneously.
  • Differentiate pub/subs in backend.
  • Use database to store message queue.
  • Better error handling.