I wrote a server side batch script that gets the user list periodically and puts it into a text field using the command line admin tool. I believe it has data to tell you how the user is connected. I have it run every 15 minutes or so. I wish there were a more direct way to do this, but FMI considers this a security issue I believe.
You could also have your app. log each users login and get the connection information in the login script and save it to a file you can access.
I have considered a log file based on entering the solution.
I could tell the users, that they need to punch a logout button to release their web/iOS seat for another to enter.
I would have preferred somthing more robust like a Get (user count) but only for web/iOS. That way I could just check if the number of active connections was below the number of rented seats.
If you use a login table, you can use the Get(ApplicationVersion) to check the app being used, and set a counter to 1 (one) if they are using a counted connection, and get the sum of the logged in users on that field to know how many concurrent connections are in use at any given time. You must handle their login record as they log out or disconnect as well for the count to be reliable.
From the FM Help files: Get(ApplicationVersion) returns:
- Pro version for FileMaker Pro
- ProAdvanced version for FileMaker Pro Advanced
- FileMaker Web Publishing version for FileMaker Web Client
- Web Publishing Engine version for FileMaker Server Web Client
- xDBC version for xDBC Client
- Server version for FileMaker Server
- Go version for FileMaker Go on the iPhone or iPod touch
- Go_iPad version for FileMaker Go on the iPad
So you could use a patternCount on both "web" and "go" in the Get(applicationVersion) to set the number of connections that need counting for the new user at login.
How would your message be triggered, and to which user(s), when the count was nearing the limit?
Users who cannot connect when the limit has been reached cannot get feedback from this system as to what's keeping them out, only the error message about not being allowed to connect to the server itself.
That is pretty much what I figured out. But how would you detect a disconnect, if the user forgets to log out?
I hope to have a bit overhead on the seats. The users would get auto logged in as a guest, but will then be greeted with a message stating that all their connections are in use - and then get logged out.
If they are below the limit they'll get to a login page using a relogin.
That was my thoughts anyway.
Best regards Per
You can set an auto time out on WebDirect, believe it defaults to 10 of 15 minutes. So if you run a batch file every so often, you can check it to see who is still logged in and who is logged out, and mark your log record accordingly. There would be some latency, but it should be minor.
More to ponder:
- I don't believe even an auto-login to a file is allowed once they reach their server connection limit, so you cannot script the over-limit message and process; they simply cannot get in to see what you intended within the file. That info may need to be provided via a separate webpage on the site.
- If you warn off users before hitting the actual user limit to avoid that problem, you are letting paid-up connections go unused except by this notification.
- Tracking the number of users in the system when some fail to log out properly or are auto-disconnected is problematic, as your scripted counts of how they are connecting becomes unreliable.
- You could try updating the user count with an onTimer script, but timer scripts can interfere with performance, probabaly even more so with webDirect, and capturing the connection app type later than the login would only work for the current account, so updating that count poses a problem.
Thanks for your input.
In my case a handful of clients are going to share the same server and they will rent the connections from me.
Of course it would not be feasible to have to much overhead on the web/iOS seats.
For now my primary goal is to limit the number of seats to fit what they pay for.
For testing purposes I have been using "Get (UserCount)" on the different database files, and that works fine for the number of users. But it seems like we really need a "Get (webiOSUserCount)" as well. That would solve part of the problem - and would give my clients a very direct motivation to get rent more seats when they need them. Then it would be up to me to control that the overall number of seats are sufficient.
This client has one FileMaker Pro license - and IF I could test if that was connected, I could use Get (UserCount) and subtract the FMP when it was logged in. Anyway to achieve that?
Create a batch file in your Filemaker Server Scripts Folder
CD C:\Program Files\FileMaker\FileMaker Server\Data\Documents\
fmsadmin list clients -y -u Adminuser -p Adminpw dir> connections.txt
Then setup a schedule in your FMS Admin Console to run this every X minutes.
You can then use the Execute Script On Server to run a script that reads the contents of the connections.txt file into Filemaker and do what you want with it.
You will get something like this.
Client ID User Name Computer Name Ext Privilege
333 USER1 WINDOWS-PC fmapp
777 USER2 192.168.1.201 fmwebdirect
You can then check this against your Log to catch any users who did not logout in a proper fashion and mark the log accordingly.
I haven't quite figured out how to run this on demand, but that should be possible.
I'll try that. Thanks. :-)
I am not sure how you ever really got this working, but I am working on something that will count connections as well and I wanted to throw my approach up here as well.
Have the clients run a UI Opener file on Go or specific URL for Webdirect. This would access FMS CWP and get the client and count directly via PHP API or through parsing of page source in a webviewer. Depending on the count acquired the user would be redirected to the actual file or given a message to try later.
This still leaves room for some error but it should be fast enough to avoid problems.
Sounds like an excellent product idea - it's been an annoying hole. If you're ready to on-sell it at some stage, please let us know. I'm guessing that there'd be a few takers. Cherry on the icing would be a way of letting users know that they're using multiple connections.