Number of users
Download this animation view to your Shared: folder in the project you want to see users online.
- Add the view to a new
LinkIcon named Number Of Users in a folder of your choise (maybe you already have a administration view or other system related views).
- Increase the
Access to SysAdmin for this link icon.
- Following view should be visible when navigating to the
LinkIcon.

This view uses the services and the wamp host itself to obtain information. All fun stuff are located in the View elements OnOpen and ServerSideJS attributes.
| OnOpen |
|---|
| //Save a reference to this view
const view = this.view;
//Call SSF and obtain user info
this.view.call('.noOfUsers').then(users=>{
//Put number of connected sessions to noOfUsers
view.noOfUsers.value(users.length);
//Put users Titles in the multiline textbox.
const userStr = users.reduce((current, entry)=>{
return `${current}\n${entry.Title}`
}, "");
view.users.value(userStr);
});
|
| ServerSideJS |
|---|
| return {
noOfUsers:async function(args, callInfo){
const call = callInfo.context.call;
//get all connected sessions
const result = await call('wamp.session.list');
if(! result)
return [];
const users = []
const promises = result.map(async (sessionId)=>{
//for each session fetch sesison information
const session = await call('wamp.session.get',[sessionId]);
const authid = session.authid;
const jwtClaims = authid.split('.')[1];
if(jwtClaims){
//use the token from each connected user and get the claims
const jwtString = Buffer.from(jwtClaims,'base64').toString('utf-8');
const claims = JSON.parse(jwtString);
if(claims.isService===undefined)
{
//if the connected session is not a service, query the Arrigo Local domain controller
//about information from the accessToken
const info = await call('accounts.%account%.dc.info', [callInfo.path],{callmeta:{token: session.authid}});
//extract and add the 'User' information and put it to list of active users
users.push(info.User)
}
}
});
//wait for all async calls to finish
await Promise.all(promises);
//Return the list.
return users;
}
}
|