Wednesday, April 09, 2014

Domino WebSocket Updates

***websocket project has been broken out into its own project, on openntf***

Just added some new features to the Domino WebSocket plugin.  Most notably, the ability to queue up SocketMessages to users that have a browser websocket connection established on the server.  Have a look at the LotusScript sample agents that create socket messages.  The below video provides a demo of the sample chat XPage application, and the SocketMessage queues.

openntf or github




Nick Wall said...

I was actually looking for Domino + node.js and came across this article, looks great. I've watched the video and downloaded files, I need to upgrade my local server from 8.5.3 --> 9. We have an (MVV*) app in production that due to requirements must make constant requests to server to check for "new\ updated" data, this puts quite a load on the server(s) with 200+ concurrent users and 1,000s of "active" docs. If I could use websockets I believe I could cut the server load dramatically. I have a couple of questions (I have just begun the websocket journey, so bare with me!):

1..have you got any idea how your solution would scale?

2..I can't seem to find the websocket.nsf file in the download on OpenNTF

Have you looked at the IBM SDK for node.js? I can't actually get to any of it as all the links for api, documentation etc. are broken for me.

Mark Ambler said...

Hi Nick,
Answers to your questions below in bold:

1. Any idea how your solution would scale?

I haven't had a chance to try any load testing on the plugin / org.java_websocket API. I really don't know how well it will scale at the moment (on my todo list)

2. I can't seem to find the websocket.nsf file

I just double checked the download. The websocket.ntf file is in the xpages-applications folder after extracting the .zip

3. Have you looked at the IBM SDK for node.js?

No I have not looked at IBM's SDK for node.js

Just FYI, I've got a few bug fixes I'll be pushing up early this week that have to do w/ inconsistent user state. Thanks for taking the time to review the plugin. If you need anymore help with setup feel free to contact me again. BTW, please leave a reply-to email, as your comment rendered a noreply-comment address, so I have no idea if you will see this text or not.



nick wall said...


Thanks for your response. I searched internet about 3 months ago, but obviously not hard enough, because I thought websockets on Domino was a non starter, so when I came across your!

I just downloaded again, and you are correct, the websocket.nsf is there. I will play with as soon as possible. My email is: nickwall at the one owned by google dot com.

My goal with all this is:

200+ users, logged in for 8hr shifts have a number of screens that must refresh every 60secs (business requirement, it would be even more aggressive if possible, but server load prevents it). Of 1,000ish at any one time "open calls", depending on their role, a subset get filtered out and handed back to user. So every 60secs, every web client requests JSON data specific to user via the REST api. Let's say it's 20 calls, the payload for those 20 calls has to be sent back every time, and we redraw. This happens even if nothing has changed on the server, or maybe only 1 or 2 docs have changed. It's a massive overhead to get probably a small amount of actually changed data. There are actually many other processes in the app that would benefit from websockets.

If I could get any "modified" data to sit in respective queue(s) for the user, then push out to web client, I think the app could scale far better: requests to server for "redundant" data would go down, reducing server CPU load. Data transfer sizes would go down.

I've been using angular.js for there last 6 months or so (my current project uses it, but app in question...we didn't even know what 2 way data binding was when we started!), I watched a presentation where a Dentistry Health provider application in the US did just that, there was a bit of complexity on the front end, but the 2 way data binding solves stacks of the issues.

Anyway, If I can get websockets working...awesome.

Mark Barton said...


Great stuff with this - I tried and failed to get Websockets working - my Java knowledge wasn't good enough to stop it locking the HTTP thread ;-)
I have some plans for this - so off to experiment now.

I will let you know how it goes.

Mark Ambler said...

Hi Mark,
I haven't experienced the thread locking problem you mention (works on my machine lol :). If you want I can take a look at your logs. Hope you have a better outcome later..



Csaba Kiss said...

I am new to websocket applications. I am trying to modify your chat application with some custom data. I could not figure out how to add some extra "attributes" to the msg object. You have a javascript when you click the send button on chat.xsp. If I try to add something like
The domino server gives me an error:
Socket Message could not be created.

I also could not figure out how to add extra stuff to the custom-data property.
Could you please help?

Mark Ambler said...

Hi Csaba,
To add custom data to the message you need to add a data attribute. For example:

var msg = new Object();"target";
msg.text="some info about this message";"custom attribute01";"custom attribute02";

Csaba Kiss said...

Hmm, if I do that, I get an error of
Cannot set property 'customAtt01' of undefined. in the console.

Mark Ambler said...

Try setting data to a new object Object();"my custom data";

Csaba Kiss said...

Yes, thank you. That solved the problem.