Session properties
A client session has a number of properties associated with it. Properties are key-value pairs. Both the key and the value are case sensitive.
- Send messages directly to that session or set of sessions.
For more information, see Sending request messages to a session filter.
- Subscribe that session or set of sessions to a topic.
For more information, see Managing subscriptions.
- Unsubscribe that session or set of sessions from a topic.
For more information, see Managing subscriptions.
A client session with the appropriate permissions can also view all of the session properties and modify the user-defined session properties. For more information, see Working with session properties.
Fixed properties
- $SessionId
- The session identifier.
- $Principal
- The security principal the session uses to connect to the Diffusion server .
- $Roles
- Authorization roles assigned to the session, represented as quoted strings (for example "client", "topic_control"). For more information, see Role-based authorization.
- $ClientType
- The client type of the session. For more information, see Client types.
- $Transport
- The transport the client session uses to connect to the Diffusion server . For more information, see Client types.
- $Environment
- The environment in which the client is running. One of JAVA_<jvm_runtime_name>_<java_version>, BROWSER_<browser>_<browser_version>, NODE_<platform>_<node_version>, DOTNET_<operating_system>_<.net_version>, C_<architecture>_<compiler>:<compiler_version>, ANDROID_<hardware>_<version>, Apple_iOS_<ios_version>, Apple_MacOS_<macos_version>, Apple_TvOS_<tvos_version>, PYTHON_<implementation_name>_<python_version>. Clients older than version 6.11 return "UNKNOWN".
- $ServerName
- The name of the Diffusion server that the client connects to.
- $Connector
- The name of the connector on which the client connected to the Diffusion server .
- $Country
- The two letter country code for the country where the client's internet address is located. The value is uppercase.
- $Language
- The two letter language code for the most common language of the country where the client's internet address is located. The value is lowercase.
- $ClientIP
- The session's IP address represented as a string.
- $Latitude
- The client session's geographic latitude, if this can be ascertained, or 'NaN' if not.
- $Longitude
- The client session's geographic longitude, if this can be ascertained, or 'NaN' if not.
- $MQTTClientId
- The MQTT client identifier. Only set for MQTT sessions. If present, the value of the $ClientType session property will be MQTT.
- $StartTime
- The client session's start time in milliseconds since the epoch.
User-defined properties
An authentication handler that allows the client session to connect can assign additional properties to the session. The keys of these properties are case sensitive, non-empty strings, and cannot contain any of ' ', '\t', '\r', '\n', '"', ''', '(', ')'
Client-proposed properties
A client can propose user-defined session properties when it opens a session. You can configure the system authentication handler to accept client-proposed properties. You can also write an authentication handler with the Authenticator interface to accept client-proposed properties and apply them to the session.