← servoy magazine

[Tip] New for 2.2: ClientInfo()

  • Tips

by Enrico Arata

I've just spend a few minutes playing with some of the new "stange and unknown" functions that Servoy dev-dream-team has added to our loved 2.2 tool:

application.addClientInfo(String additional_info) //Add additional info to a client which can be viewed in the admin

This means that if I write application.addClientInfo("Servoy Rocks") and then go to servoy-admin page and look into the client information I find: "Servoy Rocks" ... well.. ok... I don't know how I will ever use it but... interesting...

And associated to ClientInfo() we can use:

var count = application.getClientCountForInfo("String") ;//Get a count for all clients having the same additional info line

I made some tests and found that if I add more clientInfo...they are all recorded for the client, the duplicated values are not loaded twice and the getClientCountForInfo("String") will find if "String" is one of the values loaded (exact match - case sensitive)

As I was looking for a good way to know how many users are concurrently running one particular application I Ithought that:

application.addClientInfo(application.getSolutionName())
var count = application.getClientCountForInfo(application.getSolutionName())

was a clever idea... It works... it's smart and are just 2 lines of code... BUT:

var count = application.getActiveClientCount(true); //Get the active user count on the server (can be limited to current solution)

it's even smarter and uses just 1 line of code!!.

Well, although I do not know exactly how I'll use this new stuff I hope that now that you all know of the existence of them will start showing it to me here at kabootit.

Thank you in advance!!!

Comments (1)

Harjo Kompagnie
Hi Enrico, for instance if you have a multicompany solution, you can set the (unique) companyname in the clientinfo Now you can count the allowed clients for that company only! That wasn't possible with the 2.1.2 version. There, each company could open as many clients as they want (limit to the license, ofcourse!) You could do your own counting ofcourse, but that was'nt reliable. think at: abrupt killing of clients, etc.. I think it's a real nice feature!