240 likes | 506 Views
WEBSOCKETS. Lightning Talk. Fred Rodriguez Aakash Juneja CPSC 473 March 16, 2012 . What is a Socket? . The Classical Network Socket – is a communication method that is used between applications on the same computer or on different computers, and is provided by the operating system:
E N D
WEBSOCKETS Lightning Talk Fred Rodriguez AakashJuneja CPSC 473 March 16, 2012
What is a Socket? • The Classical Network Socket – is a communication method that is used between applications on the same computer or on different computers, and is provided by the operating system: • Provides bi-directional, full-duplex communication • Depends on network Ports, IP addresses to deliver data • The API is a classical C based interface, that depends on the OS • Is still used in networking applications Client Client Data Socket 2 Socket 1 Server Data
What is a Websocket? • Websocket – is a bi-directional socket that is primarily used between a Web browser and Web Server; they are Web-centric, and Object-Oriented sockets that improve and speed up the communication between browsers and servers Client Server Data Client Data Websocket 1 Websocket 2 Server
Websocket Characteristics • Websocket – is a web technology that: • Provides bi-directional, full duplex communication (information flows in both directions) • Runs on top of a standard Transmission Control Protocol socket • Helps implement Real-Time, bi-directional communication • Is not port based like a classical socket, and can by-pass Port based security • Less complicated when compared to using Comet to implement a transmit and receive communication path • An HTTP request and response is not needed every time a message is sent between the Web Browser and the Web Server • Websockets are not subject to the same origin-policy (the browser can open a socket with a server that is different from the server that originally served the web page) • HTML 5 supports Websockets
How do you use them? • The Web Socket API is designed to hide much of the complexity of socket communication • The Web Socket API is object oriented, which means: • A socket is opened when a Websocket object is constructed • Once the socket connection is established, the browser and server can send data back and forth • Once the socket is closed, it cannot be reopened; a new WebSocket objected must be constructed. • .
How do you use them? • Web sockets can be an efficient solution for a web applications that require regular communication with a server • Because a web socket is established once and used repeatedly without the need for communication over HTTP, it can greatly reduce the overhead of sending multiple HTTP headers back and forth • In addition, web sockets can eliminate the need for inefficient communication practices such as polling, in which the browser checks repeatedly for new data on the server • Because a web socket is an open communication channel, the browser only needs to listen for incoming messages. • When the server has new data, it sends a new message to the browser. The browser receives the message as it arrives • .
Extending across the Web Use case- • Multiplayer online games • Chat applications • Live sports ticker • Realtime updating social streams • Is your application truely-web competitve? • Low-latency? • Bandwidth efficient? • Cloud-ready? • Web scale? • Plugins?
WebsocketIssues • Issues • • Poor browser support require fallbacks • • Multiple versions of the protocol in play • • Protocol versions incompatible and are likely • to change again • • Possible security issues • • Not suitable for all applications (but better • than AJAX!) • • Resource considerations • Firefox 4 and Opera 11 disabledtheprotocolduetosecurityissues
Websockets in the future • Currently, only Internet Explorer 10, Chrome 16 and Firefox 11 supportthis API • Latestspecification of theprotocol defines standardsforunencripted and encryptedconnections
Websocket Links & Info • Websockets API: • http://www.w3.org/TR/websockets/ • Websockets Organization: http://websocket.org/ • Websockets Projects: • http://drupal.org/project/websockets