Sunday, September 21, 2014

Using request URI as a routing path for Domino/XPage websocket messages

In my current project, I'm going through the process of replacing a bunch of restlet programs with a single webscocket client to enable bi-directional communications with the XWork server and about 300 clients.  As part of my requirements for the app, I need to be able to send targeted websocket messages to users on a specific page to render system / log data on a dashboard to monitor the client state.  I don't want users getting socket messages in an app that is expecting a different type of socket message data.  As a result of this need, I've gone ahead and updated the Domino Websocket plugin to include support for routing messages based on the user's request URI and role.  Below are a few examples of the routing that can be achieved with a simple string in the "to" attribute of the socket message from any of your websocket enabled applications.  See the chat.ntf application for a working copy of the samples below.


  • /chat.nsf*[mgr]    (sends to everyone in the chat application with [mgr] role)
  • /chat.nsf/chat.xsp[mgr],[admin]  (sends to everyone on the specific chat.xsp page with the [mgr] or [admin] role)
  • /chat.nsf  (sends to anyone on the default page of chat.nsf)
  • /chat.nsf* (sends to everyone on any page/xpage in chat.nsf)
  • /chat.nsf/chat.xsp/CN=admin admin/O=marksdev (send direct message to user admin admin on page chat.xsp)

The request URI is also stored with the user profile created when the websocket session is established, to allow for more complex querying by background agents, SSJS, or Java (see Users by URI view in websocket.ntf).


download available here webshell-xpages-ext-lib

No comments: