Why XPages should get Web Sockets

Web Sockets

Web Sockets is not “new” but it is, in the sense that it is an HTML5 standard which is not implemented yet in all browsers. For more information check out this excellent article on it. Written two years ago !!! And yet many people have not yet heard of it.

http://www.html5rocks.com/en/tutorials/websockets/basics/

So what’s the big deal? We have web polling right now….

In a nutshell Web Sockets allows for an open connection to be maintained between the server and the client. Que? So what? I hear you say…

If you think about your twitter feed, facebook update feed or your Social information stream in Connections or Notes Social, the way it works is via a one way “polling” from the browser to the server – the conversation looks something like this via an ajax request

Browser: “Do I have anything new?”
Server: “Nope”
5 seconds goes by
Browser: “Do I have anything new?”
Server: “Nope”
5 seconds goes by
Browser: “Do I have anything new?”
Server: “Nope”
5 seconds goes by
Browser: “Do I have anything new?”
Server: “Nope”
5 seconds goes by
Browser: “Do I have anything new?”
Server: “Yes here is a new message”

What this does is create a huge amount of unnecessary bandwidth on the network – and just as importantly requires the server to maintain a ton of open threads at all times to allow for the constant polling – slowing down the server – all in it is a very expensive (but necessary) methods for getting “real-time updates” to the browser client. It also it (in shall we say less sophisticated browsers) causes a RAM increase and memory leaks – over time resulting in browser failure.

All change with Web Sockers

Web Sockets allows for an open connection – just as if your computer is on the LAN – traffic can flow both ways.

So there is no longer a need for “polling” in the same fashion.

Use Case example

If I had Web Sockets this would be the first demonstration I would do. it is directly applicable to our work environment and would :

User A

Creates an expense claim request and submits it to User B for approval.

On the server we are running a scheduled agent (or equivalent) which picks up the approval is required

User B

Logged into the intranet 3 hours ago and has not been into the expense system once.

Because she is logged into the system the supervisor has an open Web Sockets connection to the server.
The server “pushes” the new approval request to the supervisor’s browser without the need for polling and it pops up in her “stream” as a task which requires her action.

One HTTP transaction instead of many.

Other examples

Other tangible examples are :

  • Real time charting – updating your corporate stock ticker, but only when a change is necessary
  • A sidebar chat capability, changes pushed not polled
  • Web conferencing (with HTML5 audio and video tools)
  • Online games

Here’s what Jesse Gallagher told me: Having a “direct feed” between the client and backing objects on the server could lead to all sorts of interesting applications, even better than the remote services in the ExtLib

Conclusion

Web Sockets is a new technology, now supported in IE10 and will provide multiple advantages to the corporate infrastructure:

  1. Significantly reduced Web based LAN traffic due to the removal of “polling” from the browser
  2. Faster servers requiring less resources due to to the reduced traffic requests
  3. It will save money and resources
  4. It will provide for a faster browser – improving user experience.

#BringWebSocketsToXPages

Advertisement

13 thoughts on “Why XPages should get Web Sockets

  1. I wonder though whether we should look to cram everything onto the Domino Server when the better option might be to integrate with node.js. If you look at socket.io it already has everything in place and works across all browsers we just need to add the socket to socket connection from Domino to Node.

    You could either leave Domino as the application server or move the logic to node and just use Domino as a data store – sacrilege I know 😉 Next thing you know you would be questioning why you’re using Domino over something like mongo db.

    • …to which the answer is likely to be, “integrated directory, security, and messaging”. Mongo, Couch, and the like are fantastic at what they’re designed to do: storing data. But the more crucial it is that an application understand who I am, what that permits me to do, and how to notify others of my actions, the more likely it is that time spent addressing these considerations within another platform could have instead been spent implementing application-specific features in Domino.

  2. Just to let you know I have managed to get Domino to connect via a socket to a nodejs server which in turn connects via a socket to web clients as a POC.

    Its bi-directional which is good, the Domino side is an OSGI servlet running a custom Java Client which has been written to connect to socket.io running on nodejs. As far as node is concerned its just another client.

    Its not ideal of course having another middleware element but on the positive side node can bring other things to the party.

    Currently as each authenticated user connects to the node server (via a Javascript client) they are placed in there own room which uniquely identifies them – this allows for multiple client connection from the same user.

    I have a Chrome Extension running fine – which is cool as it means Chrome doesnt even need to be running for desktop notifications to be displayed and I have also tested in-browser toast notifications – including IE8 as socket.io has failback methods for browsers which do not support Websockets.

    1 of the things I need to consider is the best way to make the OSGI servlet generic, broadcasting messages to clients is straightforward and would be a HTTP API (either GET or POST) which carries the notification properties (room ID, message, type – HTML / Text, Icon?) but when it receives a broadcast from a client it needs to know what to do with it. My current thought is to have the message include a recipient ID which would map to a recipient application, the servlet would then trigger the recipient application to do something by possibly saving a document which holds the values? Probably the best thing would be to have some configuration which allows the trigger method to be configurable as well (Save document, Call URL etc). The other configurable thing of course is to allow the result of posting the message to the target application be returned back to the client as it might need to run a server side process.

    • Hi Mark.. Could you please post your POC as a new post here and detail what all you did to make websockets work with domino. I am trying similar thing but want to have a reference to refer to.

    • I want the server to support it – in this case the dojo libray would fall back on http ajax calls which would not gain me anything. Once the server supports it we could use the dojo classes or any other to facilitate the communication.

  3. When I originally commented I clicked the “Notify me when new comments are added” checkbox and
    now each time a comment is added I get several emails with the same comment.
    Is there any way you can remove people from that service?
    Thanks!
    [url=http://www.cokseslikoro.com/セリーヌ-トートバッグ-celine-セリーヌ-バッグ-レディース-horizontal-cabas-jp-7231.html]CELINE [/url] [url=http://www.cokseslikoro.com/セリーヌ-折財布-japan-4.html]セリーヌ 折財布[/url] [url=http://www.cokseslikoro.com/セリーヌ-長財布-celine-セリーヌ-財布-ラウンドファスナー-レザー-camel×midnig-jp-7182.html]セリーヌ 長財布[/url] [url=http://www.cokseslikoro.com/セリーヌ-ハンドバッグ-トートバッグ-celine-セリーヌ-バッグ-レディース-ミニラゲージ-mi-jp-7230.html]セリーヌ ハンドバッグ [/url] [url=http://www.cokseslikoro.com/セリーヌ-トートバッグ-celine-セリーヌ-バッグ-レディース-horizontal-bi-ca-jp-7219.html]セリーヌ トートバッグ [/url] [url=http://www.cokseslikoro.com/セリーヌ-長財布-celine-セリーヌ-財布-ラウンドファスナー-レザー-magentaマジェンタ-jp-7239.html]セリーヌ 長財布[/url] [url=http://www.cokseslikoro.com/セリーヌ-ショルダーバッグ-celine-セリーヌ-ワンショルダー-『20132014年新作』レザー-jp-7095.html]セリーヌ ショルダーバッグ[/url] [url=http://www.cokseslikoro.com/セリーヌ-長財布-celine-セリーヌ-財布-ラウンドファスナー-レザー-skyスカイ-10187-jp-7166.html]セリーヌ 長財布[/url]
    [url=http://www.cokseslikoro.com/セリーヌ-ハンドバッグ-celine-セリーヌ-ショルダーバッグ-2way-trapezeトラペーズ-jp-7220.html]セリーヌ
    ハンドバッグ[/url] [url=http://www.cokseslikoro.com/セリーヌ-ハンドバッグトートバッグ-celine-セリーヌ-バッグ-レディース-ミニラゲージ-min-jp-7232.html]セリーヌ ハンドバッグ[/url]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s