Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

How to get a count of current users on WAS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to get a count of current users on WAS

    Just querying if it is possible to get a count of current users on the Application server.

    I have found an Obsoleted XBASIC function called A5_COUNT_WEBSESSIONS().

    My application need:

    I have an timer event in my UX that fires every xx seconds, and I want it to check how many users are active an update a static text field for Admin users to see.

    Also is it possible to get active user data from the server i.e. the usernames of users currently logged on.

    regards

    Mike.

    #2
    Re: How to get a count of current users on WAS

    I have needed this feature since I started with the WAS. Currently I manually check the logs to see if users are currently logged in if I want to restart the server or perform any other administrative task. If I could have a variable that I could display only on admin screens would be very helpful. It would be great if an admin could log in to the website and have a window popup with server stats would be a great thing.
    ---------------------------------------------------
    Barry Kucher
    http://www.411tech.org

    Comment


      #3
      Re: How to get a count of current users on WAS

      Strictly speaking there is no way to know how many users are logged in and are still "active". If the user doesn't log out, the session may still be alive but the user long gone. But I suppose a session count would be the next best thing.
      Peter
      AlphaBase Solutions, LLC

      [email protected]
      https://www.alphabasesolutions.com


      Comment


        #4
        Re: How to get a count of current users on WAS

        TOL, I wonder if we can use Javascript to detect client-side activity, and lot that as an active user. The absence of any activity after X minutes would be counted as not active. I don't know how to do this, but the reason that today we do not know if a user is active is because they rarely refresh a browser page (like we used to do). Much of the activity is client side.
        Steve Wood
        See my profile on IADN

        Comment


          #5
          Re: How to get a count of current users on WAS

          Hii All,

          I tried the following code

          list = filefind.get("C:\A5webroot\session_folders\*.*",0,"PN|D|T")
          totalusers = line_count(list)-2
          e.control.UserCount = " Active Users = "+totalUsers+""

          It simply gets the number of files in the seesion_folder and subtracts the . and .. elements

          It is a bit agricultural - but sound???

          regards

          Mike

          Comment


            #6
            Re: How to get a count of current users on WAS

            That may be inaccurate for a couple reasons:
            • The session folder will be present until the session expires, even long after the user is gone. The shorter your session timeout, the more accurate it will be.
            • A session folder is created when anyone visits your website, whether they login or not.
            • A session folder will be created when a search engine or hacker hits the site. That could be a little or massive depending on the popularity of your site.
            • A session folder will be created when an image residing on your website is opened, even if that image is embedded in an email. (The IADN-Member image in my signature resides on my server, so I now have a new session folder just because you happen to be looking at this post.)
            • And finally, session folders are eventually going away, I was surprised to find them in V12. Mine is named session_folder_xxx.xxx.xxx.xxx with the IP address following.

            Case in point, I've attached a snapshot from my IADN session folder. It "shows" 80 people online. But I know that is erroneous and I would reboot the server if I needed to.

            Of those 80 folders in my session folder, all but 3 are totally empty. The three with content (mostly files named "GridInstance..."), now those I can assume represent recent, maybe still active users...or search engines, or hackers.

            If you only cared about logged-in users, you can get more accurate count. If you turn on login log (in Web Security) you can track logins (and logouts too). I know from looking at my log right now that the last login I had was noon yesterday by my friend Peter. But that was half a day ago, so I assume he is not logged in now.

            Personally I only care about rebooting if someone is logged in. Assuming I reboot quickly, anyone else will get a momentary system-down message and probably blame it on their own ISP.

            I used to have a utility that allowed me to "spy" on live visitors and initiate chat. You can use that type of system to see who is really active (it measured server and client activity). But don't initiate chat because, from experience, they will immediately close their account and never come back .
            Attached Files
            Steve Wood
            See my profile on IADN

            Comment


              #7
              Re: How to get a count of current users on WAS

              Hi Steve,

              Awesome info on how the session folders actually work - thank you.

              I have got the login "activity" facility on, and am logging all logins and logouts, but it seems that 99% of people just exit the browser or navigate to another server without "logging off".......so I am never sure who is still on the WAS or not.

              I cant help thinking that the WAS has all the info we require - it is just not exposed to us i.e. who is actually actively logged on.

              Alternatively.....could the Admin browser "ping" each user that the login "activity" function indicates is still logged in. If no "response" within xx sec's then the Admin browser forces a logout?

              Thanks again for the info and comments - it really helps us newbies

              regards

              Mike

              Comment


                #8
                Re: How to get a count of current users on WAS

                I use SetInterval in Javascript in the footer of all my a5w pages to keep a session alive:

                Code:
                setInterval(function() { var myelement = $('myimg'); myelement.src = 'images/session.png?rand=' + Math.random(); }, 60000);
                You could very well do an ajax callback instead of getting an image. That ajax callback could for example add a log entry in some table you could then query for all those users that have reported within the last minute or so. It would also give you some nice stats on when & how many users are using your application.
                Frank

                Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                Comment


                  #9
                  Re: How to get a count of current users on WAS

                  Frank, that seems perfect.

                  Essentially it would track every browser that has passed security and is actively being served by the WAS, not every server session (secure and non-secure) that is actively being managed by the WAS.

                  As we say here in New Zealand " Bloody awesome mate!"

                  kind regards

                  Mike

                  Comment


                    #10
                    Re: How to get a count of current users on WAS

                    Any Update On this?

                    Comment


                      #11
                      Re: How to get a count of current users on WAS

                      This isnt going to help you get to what you want but its some food for thought. I use a online chat session manager called whos on. When users are on my site I can tell what pages they are on, what browser they are using, when they got on, how long, how did they get there and of course the count. It also produces reports showing you total visitors, repeats, and a bunch of other cool stats on per day, per week or by month. I tried using session counts and its highly inaccurate due to sessions being exited and not closed.
                      Chad Brown

                      Comment


                        #12
                        Re: How to get a count of current users on WAS

                        Here is what I do. It is a hack, but it works.

                        Create a table to store session_vars, userid, login_time, etc.

                        On login, save those values to the table to represent the login. You can get the session var with just "session.sessionid".

                        That puts everyone who is online in a table, and you can show that to your user in a grid, ux, single line of text, whatever.

                        Now for the tricky part, removing the record when the user logs out or their session times out.

                        In your logout routine (mine is on logout.a5w) write code that finds their record (by sessionid or by userid) and simply delete it.

                        But most users will just abandon the website rather than logout, so you have to remove the left over record when the session times out. If your session timeout is set to 15 minutes, that means the users record will be removed within fifteen minutes, so your Logged-In list is only as good as that.

                        Now, every time anyone visits your site, whether they login or not, Alpha creates a session folder.This is true at least up through V12. It is important to understand that every unique user (browser) visit to your site creates a new session folder, even if they do not log in. And they stick around until the session expires after a period of inactivity. So an active website with a long session timeout can have thousands of session folders even if only a few are your real customers.

                        So I have a routine that runs ever five minutes, makes a list of all session folders, then removes any records from my table that are NOT in my list of session folders. Here is that code (SQL):

                        findfile = filefind.get_recurse("session_folders","*.*",FILE_FIND_DIRECTORY)
                        dim lst as c
                        for each foo in findfile
                        lst = lst + "'" + right(foo,32) + "'" + crlf()
                        next
                        findfile = crlf_to_comma(lst)
                        dim cn as sql::Connection
                        cn.open("::name::conn")
                        vsql = "DELETE FROM wt_who_is_online WHERE session_var NOT IN({findfile})"
                        vsql = evaluate_string(vsql)
                        cn.execute(vsql)
                        cn.FreeResult()
                        cn.close()
                        I told you it was a hack!
                        Steve Wood
                        See my profile on IADN

                        Comment


                          #13
                          Re: How to get a count of current users on WAS

                          If you have multiple Alpha Web/APP [WAS] servers [i.e., using load balancer] - then you may need to add an unique key to the table having the WAS server name/IP address, and run this on all servers - right?
                          Last edited by JPMPA; 03-07-2014, 03:47 PM.

                          Comment

                          Working...
                          X