Example of a simple real-time People Counter

Viewed 210

I'm looking for some direction on a simple people counter webapp that I need for an event at a non-profit next month. The idea is that for Covid, the venue is limiting the number of attendees. I'd like to have two helpers at either door with a web browser on their Smart Phones. One counts people coming in and the other counts them going out. The number displayed would be updated in real time as the other presses.

My original thought was as simple as the count and a big green circle to increment, and a red circle to decrement.

This needs to be a real time application with some kind of back end. I was thinking of using node.js and perhaps some kind of service like Pusher, but I'm looking for suggestions.

Does an something like this already exist or do any of you know of an example project that could easily be modified to turn this into a People Counter? While I'm an engineer, I know just enough about Javascript to be dangerous and it seems like I forget everything in between using it. Thanks, Chris

1 Answers

Yes, you need some backend to keep track and synchronize two pages. One thing to keep an eye on is race conditions that might occur when both people will try to update the same thing.

Conceptually, your app can be the Node.JS backend + either vanilla JS or React app on the front end. The BE will connect to FE with websockets to push the changes from the BE to the FE.

Related