Package io.mats3.matssocket
Class MatsSocketServer.MatsSocketSessionDto
java.lang.Object
io.mats3.matssocket.MatsSocketServer.MatsSocketSessionDto
- All Implemented Interfaces:
MatsSocketServer.MatsSocketSession
- Direct Known Subclasses:
MatsSocketServer.ActiveMatsSocketSessionDto
- Enclosing interface:
- MatsSocketServer
public static class MatsSocketServer.MatsSocketSessionDto
extends Object
implements MatsSocketServer.MatsSocketSession
Implementation of
MatsSocketServer.MatsSocketSession, which is serializable both for MatsSocket and Mats, i.e.
serialization mechanisms using field-based serialization.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionNote: Do realize that it is the Client that specifies this value, there is no restriction and you cannot trust that this String falls within your expected values.Note: Do realize that it is the Client that specifies this value, there is no restriction and you cannot trust that this String falls within your expected values.Note: Do realize that it is the Client that specifies this value, there is no restriction and you cannot trust that this String falls within your expected values.
-
Field Details
-
id
-
uid
-
scts
public long scts -
slts
public long slts -
clv
-
an
-
av
-
nn
-
-
Constructor Details
-
MatsSocketSessionDto
public MatsSocketSessionDto()
-
-
Method Details
-
getMatsSocketSessionId
- Specified by:
getMatsSocketSessionIdin interfaceMatsSocketServer.MatsSocketSession- Returns:
- the MatsSocketSessionId of this MatsSocketSession.
-
getUserId
- Specified by:
getUserIdin interfaceMatsSocketServer.MatsSocketSession- Returns:
- the userId owning this MatsSocketSession.
-
getSessionCreatedTimestamp
- Specified by:
getSessionCreatedTimestampin interfaceMatsSocketServer.MatsSocketSession- Returns:
- when the MatsSocketSession and its Id was initially created. Will not be reset due to cycles of
MatsSocketServer.SessionRemovedEvent.SessionRemovedEventType.DEREGISTERandMatsSocketServer.SessionEstablishedEvent.SessionEstablishedEventType.RECONNECT, asMatsSocketServer.ActiveMatsSocketSession.getSessionEstablishedTimestamp()does.
-
getSessionLivelinessTimestamp
- Specified by:
getSessionLivelinessTimestampin interfaceMatsSocketServer.MatsSocketSession- Returns:
- if this is an instance of
MatsSocketServer.ActiveMatsSocketSessionDto, effectively returnsSystem.currentTimeMillis()of whenMatsSocketServer.getActiveMatsSocketSessions()was invoked, as it was live at the time of invocation). If this is an instance ofMatsSocketServer.LiveMatsSocketSession, it literally returnsSystem.currentTimeMillis(), as it is live right now. If this is an instance ofMatsSocketServer.MatsSocketSessionDto, the reason you have this instance is that its contents was read from thedata storeusingMatsSocketServer.getMatsSocketSessions(boolean, String, String, String), and then this method returns last "liveliness update" from the data store, which is the last time this MatsSocketSession registered (i.e. became SESSION_ESTABLISHED), or from later periodic updates every few minutes while it is/was active.
-
getClientLibAndVersions
Description copied from interface:MatsSocketServer.MatsSocketSessionNote: Do realize that it is the Client that specifies this value, there is no restriction and you cannot trust that this String falls within your expected values.- Specified by:
getClientLibAndVersionsin interfaceMatsSocketServer.MatsSocketSession- Returns:
- a descriptive String representing which MatsSocket Client lib is in use ("name,version"), with
additional runtime "name and version" information tacked on separated by ";". For MatsSocket.js, this
may read as follows:
"MatsSocket.js,v0.10.0; User-Agent: {userAgentString}", or"MatsSocket.js,v0.10.0; Node.js: {node version}". For MatsSocket.dart, it could read"MatsSocket.dart,v0.10.0; Dart: {dart version}; Flutter: {flutter SDK version}", or"MatsSocket.dart,v0.10.0; Dart: {dart version}; User-Agent: {userAgentString}"
-
getAppName
Description copied from interface:MatsSocketServer.MatsSocketSessionNote: Do realize that it is the Client that specifies this value, there is no restriction and you cannot trust that this String falls within your expected values.- Specified by:
getAppNamein interfaceMatsSocketServer.MatsSocketSession- Returns:
- the "AppName" that the Client registers as, could be something like "MegaCorpWebBank". This should be rather long-term, not changing between versions of this particular application. It may be used to distinguish between two different apps using the same MatsSocketServer instance, where one of them handles Server-to-Client Requests of type "UserInfo.getCurrentGpsPosition", while the other app does not have this endpoint.
-
getAppVersion
Description copied from interface:MatsSocketServer.MatsSocketSessionNote: Do realize that it is the Client that specifies this value, there is no restriction and you cannot trust that this String falls within your expected values.- Specified by:
getAppVersionin interfaceMatsSocketServer.MatsSocketSession- Returns:
- the "AppVersion" that the Client registers as, could be something like "1.2.3-2020-04-07_beta". This should be something sane, preferably which can be alphanum-compared, so that the server could know that at-or-above "1.2.1xxxx", the app "MegaCorpWebBank" handles Server-to-Client Requests of type "UserInfo.getCurrentGpsPosition", but before this version, that particular endpoint was not available.
-
getNodeName
- Specified by:
getNodeNamein interfaceMatsSocketServer.MatsSocketSession- Returns:
- the name of the node that holds the
LiveMatsSocketSessionif it is active (i.e. state=SESSION_ESTABLISHED),Optional.empty()if not active. Will always return non-empty on anMatsSocketServer.ActiveMatsSocketSessionandMatsSocketServer.LiveMatsSocketSessioninstance.
-