Ringing a bell in your browser through WebSockets
Today at Dolbeau I wanted to make a bell ring when a new order comes in… just like Jeff Bezos did in the early days of Amazon. I wanted to make sure that our bell rings in any browser that has the bell page open. It turns out it’s super easy to do using NodeJS/Express and Socket.IO.
This is how it all works:
- Load the URL in any number of browsers
- Send a POST to the same url
- Listen to the bell ring in all open browsers!
Also you can specify which sound you want to play by using the ‘type’ POST parameter. Just check out the JS and HTML files and you’ll be good to go!