DeveloperOnCall / pubsub

Publisher-Subscriber pattern demo using Node and WebSockets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Publisher-Subscriber pattern demo using Node and WebSockets.


Languages

Language:JavaScript 53.2%Language:HTML 46.8%