jonathan-shahen / example-websocket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example Websocket Projects

Live Cursor Update

A quick example of Node Express + ws Websocket library to show the (x,y) position of all cursors connected to the server.

The cursor that is bolded is your cursor. It will always appear above other cursors

Inspiration: https://ably.com/blog/web-app-websockets-nodejs

How to test

Live Cursors example

  1. Git clone this repo
  2. cd live-cursors
  3. npm install
  4. npm start
  5. Open Multiple browser tabs/windows to http://localhost:3000/
  6. Move the mouse on all of them to see the live updating

Pub/Sub Messages

A quick example of Node Express + ws Websocket library to show an implementation of publish/subscribe, with dynamic subscriptions.

How to test

Pub Sub example

  1. Git clone this repo
  2. cd pub-sub
  3. npm install
  4. npm start
  5. Open Multiple browser tabs/windows to http://localhost:3000/
  6. Add and remove subscriptions

About


Languages

Language:JavaScript 74.2%Language:HTML 21.6%Language:CSS 4.2%