/Insights

Real-Time Web Applications with WebSockets

What are WebSockets and why would you use them?

 

Loading a traditional web page is a one-time request. Your browser asks for a page, and the web server responds with the content; done! This is great for static content, but what about content or data that is changing very quickly (think shared calendars or real-time stock counters)?

This is where websockets come in. They allow a two way asynchronous connection between a web server and a website. Once a WebSocket connection has been established, both the website and the server can send messages to each other at any time.

Awesome usage scenarios for WebSockets include:

  • A real time ticket sale counter so you will never miss out on those Justin Bieber concert tickets again.
  • Live bidding on an item you have up for sale on your site.
  • Accurate stock counts of that surfboard you want.
  • A more practical use of this technology would be keeping people informed when a disaster happens with a pop up direct to the browser.

 

Checkout this post from websocket.org for a more technical overview.