We are in this together

What?

A web experiment made using Express(web framework for Node.js), Socket.io and Particles.js in which the number of particles on the page represents the number of active users on it in realtime.

Inspired by this Nine Inch Nails song. Kinda looks like this:

How?

Express -- To handle basic routing i.e. serving index.html when a GET request is made to the homepage.

Socket.IO server -- Listen on the connection event for incoming sockets, increase the number of particles by one and emit an event to all connected clients, notifying them of the change in the number of particles to be rendered. Listen on the disconnect event fired by any socket, decrease the number of particles by one and emit an event to all connected clients, notifying them of the change in the number of particles to be rendered.

Socket.IO client -- Listen on the event emitted by the server notifying of the change in the number of particles, and render the updated number of particles.