- All Superinterfaces:
- All Known Subinterfaces:
- All Known Implementing Classes:
- Enclosing interface:
public static interface MatsSocketServer.ActiveMatsSocketSession extends MatsSocketServer.MatsSocketSession
Represents an active node-local MatsSocketSession - i.e. this instance represents a connected MatsSocketSession, having - or just had - an open WebSocket, which by definition can only be connected to a single node. Note that this means that in a fairly load balanced 3-node MatsSocketServer cluster, you should get approximately 1/3 of the ActiveMatsSocketSessions residing on "this" node, while 2/3 of them will reside on the "other" two nodes. Note: The difference between "active" and "live" is that the "active" are dumb "data transfer objects" (DTOs) which will serialize nicely with both Mats and MatsSocket serialization mechanisms, while the "live" are an interface to the actual live sessions in the MatsSocketServer, and as such has more information - but cannot be (easily) serialized, and not passed as in- or out objects on Mats endpoints.
Nested Class SummaryModifier and TypeInterfaceDescription
static enumThe state of ActiveMatsSocketSession.
Method SummaryModifier and TypeMethodDescriptionIf we have a way to find the connected (remote) address, it will be exposed here.
- the active Authorization value, only available when
- The name of the Principal, as returned by
Principal.getName(), only available when
getRemoteAddrIf we have a way to find the connected (remote) address, it will be exposed here. It can be set/overridden in the
AuthenticationPlugin. Be advised that when the WebSocket Server (i.e. Servlet Container) is behind a proxy, you will get the proxy's address, not the end client's address, aka originating IP address. This can, if you add the functionality to the
AuthenticationPlugin, be gotten by
getOriginatingRemoteAddr(). Note: The remote address is not exposed by the JSR 356 Java API for WebSockets - but there are hacks for different Servlet Containers to get it anyway. Check out class
- the remote address if available (should be an IP address).
AuthenticationPlugincan set the originating remote IP address - which must be derived by headers like
X-Forwarded-For(Wikipedia). Note the problems with this header: Since the originating client can set whatever he wants as initial value, you cannot rely on the "first IP address in the list", as this might well be bogus. You must go from the last and work your way up, and only trust the information given by proxies you are in control of: The first IP address in the list that you do not know, is what you should set as originating remote address. Each proxy adds the remote address that he sees (i.e. who is the remote address for him). This means that the last proxy's ip address is not in the list - this must be gotten by
- the originating remote address if
AuthenticationPluginhas set it (should be an IP address).
- which Topics this session has subscribed to.
- when this MatsSocketSession was established - this timestamp is "reset" on every
RECONNECT(and of course set on initial connect, i.e.
NEW), as opposed to
MatsSocketServer.MatsSocketSession.getSessionCreatedTimestamp()which is set a single time when the session if first created.
- timestamp (millis-since-epoch) of when we the client was last authenticated: When
AuthenticationPlugin.AuthenticationContext.authenticated(Principal, String), or when
AuthenticationPlugin.SessionAuthenticator.reevaluateAuthentication(AuthenticationContext, String, Principal)returned
- timestamp (millis-since-epoch) of when we last received a PING message from the Client.
- timestamp (millis-since-epoch) of when the Server last received an information bearing message (SEND, REQUEST, RESOLVE or REJECT) from the Client, or when the Server last sent an information bearing message (SEND, REQUEST, RESOLVE, REJECT or PUB) to the Client
- snapshot (i.e. newly created ArrayList) of last 200 (per default) envelopes going between client and server in both directions.