Hidden Presence Service within Oracle Content Management

Want to enable the ability to see who is online on your website? OCM has a few hidden tricks up it's sleeve.. With that said.. none of this is documented with  the OCM documentation guides and it's not officially support.. but.. I'll share how to enable this feature on your site!

Overview

There are two undocumented channels FC (FrontChannel) and you guessed it.. BC (BackChannel) that OCM uses for it's admin UI which .. you can also use on your site - but be warned this is unsupported and these services could be dropped or changed at anytime... but with that said they are very tightly connected with the OCM admin interface.. So in my opinion the chances for this to happen would be low and if you are looking for a free presence service tied into your users accounts here's how you can use it..  

FC API Endpoint

${contentServer}/osn/fc/RemoteJSONBatch

As you can guess this service is provided by the onTrack/Oracle Social Network integration & if you are lucky enough to have the original PDF documentation guides then this all makes sense.. if not.. it's a lot of reverse engineering to use this.

I'm going to go ahead and request 2 datasets one for the user login Info and another to find out the user presence status. Todo that I can pass in an array of methods and params against a module that is setup and there is a Connection and Presence Module that can give me the data I need.

If you post this data then you can get the info needed for the active user.

//array methods to send to frontchannel
//method: getLoginInfo - brings back all user info and session data
//method: active - sets user as active
[{
  Arguments: [],
  MethodName: "getLoginInfo",
  ModuleName: "XConnectModule$Server",
},{
  Arguments: [],
  MethodName: "active",
  ModuleName: "XPresenceModule$Server",
}]

If you want to get session information on another user you can call

[{
  Arguments: ["<UserID>"],
  MethodName: "getUser",
  ModuleName: "XUserModule$Server",
}];
If you want to dig into the OSN / Ontrack documentation here is a link to the XPresence Module - https://docs.oracle.com/cd/E20968_01/doc.1/e20955/waggle/common/modules/presence/XPresenceModule.Server.html

Extra Headers required

As part of the request I also send the following additional headers.

  1. X-Requested-With: XMLHttpRequest
    Notify that this is a web request.
  2. X-Waggle-Agent: atlas
    This can be anything and allows you to identify the active session in the API
  3. X-Waggle-APIVersion: 8118
    At the time of writing the current max API version is 12292
    You can get this info from /osn/social/api/v1/connections API request  when initiating the connection.
  4. X-Waggle-ClientID: 2c20e660dd64fe954e9dd335f18aae80
    You can set this as the APIRandomID which you can also get from /osn/social/api/v1/connections. This is important as it tells the session you are still active.
  5. X-Waggle-ForceLanguage: en
    Your language.. I haven't tested with any other..

Checking session details

From the getLoginInfo response you can look in the response object and check the PresenceIdleMS; and then go into the  userInfo Object and take a look at the timestamps - LastConnectedDate, LastDisconnectedDate.

There is also UserSessionInfos object which should have your session within the array of sessions and the agent name you defined with the flag activeSession:true.

💡
You can also use LastConnectedDate, LastDisconnectedDate - if the LastDisconnectedDate was greater than LastConnectedDate then the user had disconnected. - don't forget you will need to ping the active method against the XPresenceModule Module to re-initialise the session before it times out within 10 mins.

Demo

I'll see if I can dig-up my original code and share a sample of using the OCM presence service and maybe create a free widget. :)