MORGENLAND

  • STOCKHOLM
  • |
  • +46 768 445 091
  • |
  • INFO@MORGENLAND.SE

A DIGITAL AGENCY

Reach, please and keep
the consumers of today.

  • About Us

  • Work

  • Trends

  • Contact

Happy web sockets

Technology

Because the web is largely build on the http protocol and its request & response mechanism, dynamic and quick access to data has been initiated on user interaction – Click and wait for new page to load and render with new data.

When AJAX came around a few years ago, the technique started to bring more dynamic interactivity to web. But still, all communication was imitated by user interaction (or periodic polling) to load new data from the server. Usually server initiated connections is a hack created to give the illusion of interactivity or responsiveness is leaving the connection open for longer and “hanging”. It’s possible for a request to time-out, and a new connection will be needed anyway. Other techniques involve Flash, XHR multipart requests. However, all of these work-arounds share one problem: They carry the traffic overhead of HTTP, which doesn’t make them well suited for low latency applications.
Technologies that enable the server to send data to the client in the very moment when it knows that new data is available have been around for quite some time. The umbrella term often used to describe this is “Push” or sometimes “Comet”.

One of the cool new features of HTML5 is WebSockets, and they are a bit different are different though. WebSockets is a type of push technology basically. The technique makes it possible to open an interactive communication session between the user’s browser and a server. With this it let us talk to the server without using AJAX requests. The WebSockets specification defines an API (Application Programing Interface) establishing “socket” connections between a web browser and a server. In plain words: There is an open connection between the client and the server and both parties can start sending data at any time. This has its benefits: decreased latency being one of them, as a connection that has already been opened does not require a new connection to be established.

Examples? There are many cross platform APIs developed by third party developers that aims to make real-time apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. Most build upon using JavaScript in real-time. At the moment, the use of these APIs, is still being standardized by the W3C; however, the latest versions of Chrome and Safari have support for WebSockets.

We hope to se more great usage of WebSockets and continue to make the web a happier place.

Morgenfeed - Social Media. NEWS AND ARTICLES WE FIND INTERESTING