Introduction of WebSockets

20
WebSocket s? What are

description

Introduction of WebSockets, how it works, compression with AJAX, WebSockets represent a long awaited evolution in client/server web technology.

Transcript of Introduction of WebSockets

Page 1: Introduction of WebSockets

WebSockets?What are

Page 2: Introduction of WebSockets

WebShocketsWebSockets represent a long awaited evolution in client/server web technology.

They allow a long-held single TCP socket connection to be established between the client and server which allows for bi-directional, full duplex, messages to be instantly distributed with little overhead resulting in a very low latency connection.

Page 3: Introduction of WebSockets

Both the WebSocket API and the WebSocket protocol are

standardised which means the web now has an agreed standard

for realtime communication between Internet clients and

servers.

Page 4: Introduction of WebSockets

Originally considered a browser technology, WebSockets are reaching far beyond just web browsers and are becoming a cross platform standard for realtime communication between client and server

Page 5: Introduction of WebSockets

As well as native WebSocket support in browsers such as Google Chrome,

Firefox, Opera and a prototype Silverlight to JavaScript bridge

implementation for Internet Explorer, there are now WebSocket library

implementations in Objective-C, .NET, Ruby, Java, node.js, ActionScript and

many other languages.

Page 6: Introduction of WebSockets

A brief history of the web(from a developer’s perspective)

Page 7: Introduction of WebSockets

The Internet wasn’t built to be all that dynamic. It was conceived to be a collection of HyperText Markup Language (HTML) pages linking to one another to form a conceptual web of information.

Page 8: Introduction of WebSockets

Over time the static resources increased in number and richer items, such as images, began to be part of the web fabric.

Server technologies advanced allowing for dynamic server pages - pages whose content was generated based on a query.

Page 9: Introduction of WebSockets

Soon the requirement to have more dynamic web pages lead to the availability of Dynamic HyperText Markup Language (DHTML) all thanks to JavaScript (let’s pretend VBScript never existed). Over the following years we saw cross frame communication in an attempt to avoid page reloads followed by HTTP Polling within frames.

Page 10: Introduction of WebSockets

Things started to get interesting with the introduction of LiveConnect, then the forever frame technique, and finally, thanks to Microsoft, we ended up with the XMLHttpRequest object and therefore Asynchronous JavaScript and XML (AJAX).

In turn, AJAX madeXHR Long-Polling and XHR Streaming possible. But none of these solutions offered a truly standardised cross browser solution to realtime bi-directional communication between a server and a client.

Page 11: Introduction of WebSockets

Then along came

WebSockets

Page 12: Introduction of WebSockets

Why WebSockets are a game-changer?

Finally,WebSockets represent a standard for bi-directional realtime communication between servers and clients.

Firstly in web browsers, but ultimately between any server and any client.

Page 13: Introduction of WebSockets

Why WebSockets are a game-changer?

The standards first approach means that as developers we can finally create functionality that works consistently across multiple platforms.

Connection limitations are no longer a problem since WebSockets represent a single TCP socket connection.

Page 14: Introduction of WebSockets

Why WebSockets are a game-changer?

Cross domain communication has been considered from day one and is dealt with within the connection handshake.

This means that services such as Pusher can easily use them when offering a massively scalable realtime platform that can be used by any website, web, desktop or mobile application.

Page 15: Introduction of WebSockets

WebSocketsvs

AJAX

Page 16: Introduction of WebSockets

WebSockets vs AJAX

WebSockets don’t make AJAX obsolete but they do supersede Comet (HTTP Long-polling/HTTP Streaming) as the solution of choice for true realtime

functionality.

Page 17: Introduction of WebSockets

AJAX should still be used for making short-lived web service calls, and if we eventually see a good uptake in CORS supporting

web services, it will get even more useful.

WebSockets vs AJAX

Page 18: Introduction of WebSockets

WebSockets should now be the go to standard for realtime

functionality since they offer low latency bi-directional

communication over a single connection.

WebSockets vs AJAX

Page 19: Introduction of WebSockets

Even if a web browser doesn’t natively support the WebSocket object there are polyfill fallback options which all but guarantee any web browser can

actually establish a WebSocket connection.

WebSockets vs AJAX

Page 20: Introduction of WebSockets

Thanks…

Created By: Ashish KumarSource: http://pusher.com/websockets