OpenSimulator Internals/Connector Architecture/Presence Connector
Appearance
OpenSimulator Internals/Connector Architecture/Presence Connector
[edit]Overview
[edit]PresenceServicesConnector is the simulator-side remote connector for IPresenceService. It translates IPresenceService calls into HTTP POST requests to the ROBUST Presence handler at /presence.
Source file:
OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
Initialisation
[edit]Config section: [PresenceService]
Required key:
- PresenceServerURI -- URL of the ROBUST Presence endpoint; throws if missing
Base class BaseServiceConnector.Initialise() called for auth setup.
Three constructors:
- Default (no args) -- URI must be set externally
- String URI -- used by callers that pass the URI directly
- IConfigSource -- calls Initialise(), normal grid mode
Transport
[edit]All methods POST to m_ServerURI + "/presence" using SynchronousRestFormsRequester.
All requests include:
- VERSIONMIN / VERSIONMAX -- protocol version negotiation
- METHOD -- identifies the operation
Success detection for login/logout/report methods:
- LoginAgent, LogoutAgent, LogoutRegionAgents: scan raw reply string for "success" (case-insensitive substring search -- not XML parse)
- ReportAgent: parses XML response, checks result field == "success"
- All return false on empty reply or exception
Methods
[edit]| Method | METHOD field | Fields sent | Returns |
|---|---|---|---|
| LoginAgent(userID, sessionID, secureSessionID) | "login" | UserID, SessionID, SecureSessionID | bool |
| LogoutAgent(sessionID) | "logout" | SessionID | bool |
| LogoutRegionAgents(regionID) | "logoutregion" | RegionID | bool |
| ReportAgent(sessionID, regionID) | "report" | SessionID, RegionID | bool |
| GetAgent(sessionID) | "getagent" | SessionID | PresenceInfo or null |
| GetAgents(string[] userIDs) | "getagents" | uuids (List<string>) | PresenceInfo[] or null |
GetAgent():
- Parses XML response
- Returns PresenceInfo constructed from result dictionary
- Returns null if result == "null", reply is empty, or result is not a dictionary
GetAgents():
- Sends userIDs as uuids key (List<string>)
- Iterates all values in reply dictionary, constructs PresenceInfo for each dictionary entry
- Returns empty array if result == "null" or "Failure"
- Returns null on empty reply or exception
Notes
[edit]- LoginAgent, LogoutAgent, and LogoutRegionAgents use raw string search for "success" rather than XML parsing -- different from ReportAgent which parses XML. This is inconsistent within the same file.
- ScopeID fields are present in the code but commented out throughout.