You're currently browsing the Ignition 8.0 docs. Click here to view the latest docs.

The following feature is new in Ignition version 8.0.7
Click here to check out the other new features
This function is used in Python Scripting.

Description

Returns information about one or more Perspective sessions. The information returned by this function is a combination of information available on the perspective sessions status page on the Gateway, and some session props (id and userAgent). Exact fields are:

keyvalue
userAgentInformation the device running the Session. The exact content returned by this key is based on the the browser/device running the Session.
id

Either the Id of the session (similar to session.prop.id) or if called from the Designer, returns the Designer's id, as listed on the Designers Status page located on the gateway.

usernameEither the username of the logged in user if authenticated, "Unauthenticated" if an unauthenticated session.
projectThe name of the project running in the session.
uptimeThe number of milliseconds that the session instance has been running.
clientAddressThe address of the session.
lastCommThe number of milliseconds since the last communication from the Gateway.
sessionScopeWhere the session is running. Possible values are: designer, browser, ios, or android.
activePagesThe number of active pages.
recentBytesSentThe number of bytes last sent by the session to the Gateway.
totalBytesSentThe total number of bytes sent by the session to the Gateway.
pageIdsAn array of page IDs that are currently open in the session.

This function accepts keyword arguments.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.perspective.getSessionInfo([usernameFilter], [projectFilter])

  • Parameters

String usernameFilter - A filter based on logged in user.  [optional]

String projectFilter - A filter based on the project.  [optional]

  • Returns

List A list of objects (PyJsonObjectAdapter).

  • Scope

Perspective Session

Code Examples
Code Snippet
# This code counts the number of times a user named "billy" is logged in
sessions = system.perspective.getSessionInfo("billy")
print "Billy has %d sessions" % len(sessions)
Code Snippet
# This script will get all sessions using the "MyProject" project and display information about them.
# Get the session info.
projectResults = system.perspective.getSessionInfo(projectFilter="MyProject")
# Loop through the sessions.
# Enumerate() gives both the session object and the index.
for index, sessionObj in enumerate(projectResults):
    # Print session info.
    print "Session", index, ": username: ", sessionObj["username"], "uptime: ", sessionObj["uptime"], " seconds"
Keywords

system perspective getSessionInfo, perspective.getSessionInfo

  • No labels