MessageEventListeners will be invoked for every processed incoming and outgoing message for any session.
MatsSocketServer.SessionRemovedEventlisteners will be invoked when an
MatsSocketServer.LiveMatsSocketSessionis removed from this node of the
MatsSocketServerinstance cluster - this is both when a MatsSocketSession is
DEREGISTERed, in which case the Client can still
RECONNECTto the same MatsSocketSessionId, and when a MatsSocketSession is
SessionAuthenticator.initialAuthentication(..)to denote good authentication, supplying a Principal representing the accessing user, and the UserId of this user.
AuthenticationPlugin.AuthenticationContext.authenticated(Principal, String)that grants the authenticated user special abilities to ask for debug info of the performed call.
AuthenticationPlugin.AuthenticationContext, which you are supposed to return from the
AuthenticationPlugin.SessionAuthenticatorto inform the
MatsSocketServerabout your verdict of the authentication attempt.
AuthenticationPluginto tell the
MatsSocketServerwhich types of information the specific user is allowed to request - the resulting debug/meta information provided is the intersection of the requested + allowed.
ClusterStoreAndForward, perform DB preparations and migrations.
ClusterStoreAndForward.registerSessionAtThisNode(String, String, String, String, String, String)if the userId does not match the original userId that created this session.
ClusterStoreAndForward_SQLneeds, using Flyway.
full methodthat uses the
appNamethat the MatsFactory is configured with as the 'instanceName' parameter.
request, this method returns the 'correlationBinary' that was provided in the request.
request, this method returns the 'correlationString' that was provided in the request.
ConcurrentMapto keep its set of local, live, currently connected MatsSocketSessions.
MatsInitiateinstance, which is the same as the
forwardXX(..)methods utilize, you can initiate one or several Mats flows, in addition to your actual handling of the incoming message - within the same Mats transactional demarcation as the handling of the incoming message ("actual handling" referring to
denyor ignore - the latter two being a bit hard to understand why you'd want).
MatsSocketServer.getMatsSocketSessions(boolean, String, String, String), only returning the count - this might be interesting if there are very many sessions, and you do not need the full DTOs of every Session, just the count for a metric to graph or similar.
MatsSocketServer.getMatsSocketSessions(boolean, String, String, String)- go read there for semantics.
MatsSocketServer.getMatsSocketSessionsCount(boolean, String, String, String)- go read there for semantics.
SessionAuthenticator#reevaluateAuthentication(AuthenticationContext, String, Principal)SessionAuthenticator.reevaluateAuthentication(..)} to denote BAD authentication, supplying a reason string which will be sent all the way to the client (so do not include sensitive information).
MatsSocketServer.IncomingAuthorizationAndAdapterwithout forwarding to Mats.
MatsSocketServer.ReplyAdapterwhich can adapt the reply from the Mats endpoint before being fed back to the MatsSocket - and also decide whether to resolve or reject the waiting Client Promise.
MatsSocketServer.ActiveMatsSocketSession, which is serializable both for MatsSocket and Mats, i.e.
ClusterStoreAndForwardand which cannot "hide" the situation if the data store doesn't work.
Principaland decide whether this message should be forwarded to the Mats fabric (or directly resolved, rejected or denied).
MatsSocketServer.IncomingAuthorizationAndAdaptergets to work with when handling an incoming MatsSocket message.
MatsSocketServer.MatsSocketEnvelopeDtowhich carries some metadata about the processing of the Envelope.
data storewhen gotten via
MatsSocketServer.getMatsSocketSessions(boolean, String, String, String)(returning
MatsSocketSessionDto), or an
ActiveMatsSocketSessionrepresenting an active MatsSocketSession connected to this node of the MatsSocketServer instance when gotten via
ActiveMatsSocketSessionDto), or a
LiveMatsSocketSessionwhich is an interface view over the actual live session in the MatsSocketServer when gotten via
MatsSocketServer.MatsSocketSession, which is serializable both for MatsSocket and Mats, i.e.
MatsSocketServer.MatsSocketEnvelopeDto.msg-field is of this magic type, the String it contains - which then needs to be proper JSON - will be output directly.
MatsSocketServer.MatsSocketEnvelopeWithMetaDtowill be Serialized (made into object) with the "msg" field handled specially: If it is any other class than
MatsSocketStatics.DirectJson, default handling ensues (JSON object serialization) - but if it this particular class, it will output the (JSON) String it contains directly.
MatsSocketServer.MatsSocketEnvelopeWithMetaDtowill be Deserialized (made into object) with the "msg" field directly to the JSON that is present there (i.e.
ClusterStoreAndForward_SQL_DbMigrations.getPlaceHolders(), and the migration scrips from
MatsSocketServerupon each WebSocket connection that wants to establish a MatsSocket - that is, you may provide a connections-specific instance per connection.
Endpoint.onOpen(Session, EndpointConfig)invocation from the WebSocket
ClusterStoreAndForward.getMessagesFromOutbox(String, int)will again return messages that has previously been marked as attempted delivered with
MatsSocketServer.request(String, String, String, Object, String, String, byte)REQUEST}.
REQUESTs: Send "Reject" reply (rejects the client side Promise) to the MatsSocket directly, i.e.
MatsSocket terminator- which includes a String "correlationString" and byte array "correlationBinary" which can be used to correlate the reply to the request (available
herefor the reply processing).
REQUESTs: Send "Resolve" reply (resolves the client side Promise) to the MatsSocket directly, i.e.
MatsSocketServer.ActiveMatsSocketSession.getOriginatingRemoteAddr()- read that JavaDoc.
MatsSocketServer.ActiveMatsSocketSession.getRemoteAddr()- read that JavaDoc, in particular that if this server is behind a proxy, this will be the proxy's address.
SessionAuthenticator#reevaluateAuthentication(AuthenticationContext, String, Principal)if the 'existingPrincipal' (and implicitly the userId) is still good to go.
MatsSocketServer.ActiveMatsSocketSessionon this node, closing the WebSocket with
CloseReason.CloseCodes.SERVICE_RESTART(assuming that a MatsSocket service will never truly go down, thus effectively asking the client to reconnect, hopefully to another instance).
ClusterStoreAndForward.MessageIdAlreadyExistsException), the result from the previous processing can be returned right away.