1 2 Previous Next 16 Replies Latest reply on Jul 12, 2016 9:52 AM by taylorsharpe

    Limiting connections to a hosted database

    Tom_Droz

      Dear FM Communtinity

       

      I sell a vertical solution to used car dealers.  My customers each have a database which are all hosted on my server.  (FM Server 14)

       

      I sell my service based on number of user.  I limited access by licenses, with each customer having as many licenses as I would provide to them at a monthly fee. I did not have web direct turned on for them.

       

      Limiting access this way is easy to control.

       

      As FileMaker is shifting to another access model I am looking at allowing access via a web viewer or Filemaker Go.

       

      It seems that FileMaker has not introduced robust features where I can limited a customer to a specific number of connections.  Example: If I wanted to limited XYZ database to 3 connections this doesn't seem possible.  Yet FileMaker server knows exactly how many connections there is to a given database.

       

      FileMaker needs to provide tools that allow the connections to be limited to a specific number.
      Am I missing something?

       

      Tom

        • 1. Re: Limiting connections to a hosted database
          mikebeargie

          You're not missing any native functionality. There definitely should be a feature under "file options" that allows for a max number of connections at a time, but with the switch to user based per-server licensing, I'm not even sure that's in the pipeline anymore.

           

          I've gotten around this by coding my own "sessions" table inside of a file, and having a server scheduled script that cleans up orphaned sessions.

           

          Basically:

           

          1) User logs in, new record in "sessions" with login time. global $$session UUID set.

          2) OnTimer script runs during user session, and will send PSoS every x number of minutes to update the $$session "last check in" time.

          3) Server schedule script finds for records where the last check in time is > x minutes and check out time isempty. Marks those sessions as checked out.

          4) OnLastWindow close script will write a time to the "check out time" field for $$session.

           

          Once I've established that routine, I can add to the opening script a check for the number of session records without a "checked out" time. I also force a timeout that corresponds to the x number of minutes of inactivity.

           

          Make sure to reserve a few seats on your server for "overflow" and developer access.

          • 2. Re: Limiting connections to a hosted database
            Tom_Droz

            Mike

            The new user based model makes this need much more important!

             

            If I have customer 'A' that I am selling 2 access too, he could be on his cell phone, laptop and a dozen other places using up multiple licenses!

             

            Meanwhile customer B cant get on because of A has used up all the connections

            • 3. Re: Limiting connections to a hosted database
              mikebeargie

              If you implemented the session model as I noted, you could limit Client A so that they would only be able to connect with one device, and the second one would be booted out when attempting to connect.

               

              Each device counts as a user under the new licensing, so you would want to sell Client A connections based on that.

              • 4. Re: Limiting connections to a hosted database
                Tom_Droz

                Mike

                As I understand it that is not correct for my situation.

                 

                All my customers are on one server.  The license are for the server.  So if I have 100 licenses, but only want Customer A to access 3, there is no way I can prevent him from accessing more than that using a Filemaker feature.  The feature you described on the wish list, is what is needed and now more than ever for anyone selling a vertical solution like mine.

                 

                Tom

                • 5. Re: Limiting connections to a hosted database
                  mikebeargie

                  You are misunderstanding then. There is a way to limit their connections, you just have to manually build it into the file they are connecting to, rather than relying on a more simple filemaker server setting approach that does not exist yet.

                   

                  Every file can run an OnFirstWindowOpen and Close script, so it’s very much possible to setup your own session tracking and connectivity limits. I am speaking from experience as I have set this up multiple times since v13 introduced concurrent connections.

                   

                  Yes the licenses are combined on your server, but you can set, inside of each client’s file, a hard limit for the number of “session” records allowed to be open at once for that file. This allows you to divide the connections that you have paid for, among your different clients.

                   

                  Yes, it would be EASIER if FileMaker just added a “allow x number of active connections to this file” setting, but it’s not currently impossible to do it.

                  • 6. Re: Limiting connections to a hosted database
                    Tom_Droz

                    Mike there are a few issues here

                     

                    1) To run the test, you use up a license

                     

                    2) You are not testing for live connection (maybe I am wrong ) you are testing for connections that didn't sign out..  This is just not a reliable way to know how many live connections you have

                     

                    3) FileMaker knows exactly how many live connections you have, but there is no tool to allow this information to be used by the programmer.

                     

                    thanks for your thoughts and feedback on this!

                     

                    Tom

                    • 7. Re: Limiting connections to a hosted database
                      mikebeargie

                      Yes,

                       

                      The key is to set a hard timeout to disconnect idle users, and a server scheduled script to “cleanup” orphaned sessions.

                       

                      Also, the OnTimer script should be run without allowing user abort, so that the user is forced to check in on their session while it is up to date.

                       

                      It is not foolproof, but it’s possible.

                       

                      Alternatively, you could use a CWP connection and have a readout of the sessions table to check for an open session without requiring the use of a connection. This would however require your users to always connect through a website making that check first though, instead of just connecting directly to their file.

                      • 8. Re: Limiting connections to a hosted database
                        Tom_Droz

                        Mike

                        Thanks for what is the current best method.  It would be great for someone to post a sample file of this that has been used in production.

                         

                        Nonetheless, to my thinking this method is not adequate.   It forces users off that might have stepped away for a moment.   They have needless nag screens.  If they are logged out or forced off they may not be able to get back in until someone that has 2 instances open is forced out.

                         

                        Filemaker needs to provide tools, not work arounds.  Filemaker's entire cost system is based around this issue, yet they are not providing tools to properly manage it.

                        • 9. Re: Limiting connections to a hosted database
                          SecretWeaponLabs

                          It sounds like your solution limits users to distinct files instead of one big master DB.  In that case, if you don't care if it's via Go or WD or FMP, then Get(UserCount) should work without any problem.


                          If you want to segregate based on connection, then Wim's method is the way to go, but rather than requiring a re-login every couple of mins, I would make a centrally-called script (called from every often-used script) extend a timeout and also check the usercount somewhere centrally in FM.

                          • 10. Re: Limiting connections to a hosted database
                            mikebeargie

                            Did Wim chime in here and I missed it?

                             

                            The technique I had mentioned uses an OnTimer script to push the session forward on a regular interval, and could be done as a PSoS script to not interfere with the user session. Just be careful not to break it with halt script or anything.

                            • 11. Re: Limiting connections to a hosted database
                              Tom_Droz

                              Thanks for that idea, does GetUser Count include CWP connections?

                               

                              thanks

                              • 12. Re: Limiting connections to a hosted database
                                Tom_Droz

                                Hi Mike

                                If there is a sample file you wanted to share, I'm sure I am not the only person that would be interested in looking at it.

                                 

                                Thanks as always for all you good ideas

                                 

                                tom

                                • 13. Re: Limiting connections to a hosted database
                                  mikebeargie

                                  I don’t have one, and right now I’m head-deep in polishing my content for my sessions next week at Devcon.

                                   

                                  If you can circle back with me in around three weeks I can try and get one together to share.

                                  • 14. Re: Limiting connections to a hosted database
                                    kurt.bleicken

                                    How about this?

                                     

                                    Make a login table which creates a new record when the user logs in. Record the user's unique key, and the client ID and a timestamp. Then immediately after they log in search for all users with the same client ID. If that number greater than they have subscribed for, a number in your client table,  give the user a polite message and log them out.

                                     

                                    If you want to restrict a user to one session at a time you can script a search for the user and again give them a message if they are logged in using different devices. If they want to be able to log in more than one way, charge them for more licenses.

                                    1 2 Previous Next