com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

WebSockets

What is a WebSocket

WebSocket is a protocol that is designed to stream data using port 80 and port 443 and it comes as a part of HTML5. Furthermore, WebSocket is a protocol providing full-duplex communications channels over a single TCP connection. Unlike TCP sockets, WebSockets can operate on standard web ports. As a result, there is no hassle of opening ports for applications, worrying about firewalls and virus-guards etc.

Evolution of WebSockets

In the past websites were just used to share information. All most all the websites only included words and images and there were no such things called commercial websites. Moreover, when it came to hardware, web servers had limited memory and storage, but it had to scale to serve a large number of users. As a result, to cope with these requirements engineers came up with a protocol called HTTP. This was purely based on the request/response paradigm. Whenever there is a new request, the web server creates a new socket and serves the request with a response and as soon as the response is sent the server closes the socket and reacquires the resources that were allocated.

This was fine before people came up with RIAs which gave birth to a large number of commercial websites. As time went on both software and hardware kept on evolving. Now with the help of AJAX and SOAP web applications are able to send asynchronous request to web servers. In addition, web servers are now rich with memory, storage and high processing power. This provided the perfect platform for RIAs and consequently RIAs became more and more like standalone applications. At this point HTTP became inadequate and this gave birth to WebSockets.

How WebSockets work

The following diagram depicts how a WebSocket communication is initiated.

Initial WebSocket handshake request is done using HTTP. Then upon successful handshake, both the web client and server upgrade their communication protocol to WebSocket. Thereafter, communication is done using WebSocket frames. The WebSocket communication does not have to be request/response. WebSocket frames can flow back and forth as they wish like a normal TCP socket connection.

The initial handshake request which is sent using the HTTP protocol has to include certain header fields such as the origin header, HTTP compliant version header, WebSocket subversion header and more. These headers and frames can be seen with the help of google-chrome's developer tool and you can try this out using the demo site to check WebSocket communication.

WebSockets and UES

Jaggery WebSocket enables full duplex transmission and it supports WebSocket specification. It defines an API establishing "socket" connections between a web browser and a server. This results in a persistent connection between the client and the server, and both parties can start sending data at any time.

Users can use various gadgets that are available in WSO2 Enterprise Store, to create their own customized dashboards using WSO2 User Engagement Server (UES). The UES dashboards require real-time data. As a result, WebSockets are enabled in UES gadgets to ensure bi-directional real-time communication between servers and clients.

Creating WebSocket Enabled Gadgets  - for a sample on how to use WebSockets with UES

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.