MessageEventListener
s will be invoked for every processed incoming and outgoing
message for any session.SessionEstablishedEvent
listeners will be invoked when an
LiveMatsSocketSession
is established on this node of the
MatsSocketServer
instance cluster, i.e.MatsSocketServer.SessionRemovedEvent
listeners will be invoked when an MatsSocketServer.LiveMatsSocketSession
is removed from this
node of the MatsSocketServer
instance cluster - this is both when a MatsSocketSession is
DEREGISTERed
, in which case the Client can still
RECONNECT
to the same MatsSocketSessionId, and when a
MatsSocketSession is CLOSEd
or TIMEOUTed
.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.SessionAuthenticator
to inform
the MatsSocketServer
about your verdict of the authentication attempt.AuthenticationPlugin
to tell the MatsSocketServer
which types of
information the specific user is allowed to request - the resulting debug/meta information provided is the
intersection of the requested + allowed.AuthenticationPlugin.newSessionAuthenticator()
.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_SQL
needs, using Flyway.full method
that uses the appName
that the MatsFactory is configured with as
the 'instanceName' parameter.LiveMatsSocketSessions
.request
, this method
returns the 'correlationBinary' that was provided in the request.request
, this method
returns the 'correlationString' that was provided in the request.ConcurrentMap
to keep its set of local, live, currently
connected MatsSocketSessions.MatsInitiate
instance, 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
forward
, resolve
,
reject
or even deny
or ignore - the latter two being a bit hard to
understand why you'd want).this.getMatsSocketEndpoint().getMatsSocketEndpointId()
.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.ClusterStoreAndForward.outboxMessagesAttemptedDelivery(String, Collection)
).AuthenticationPlugin
can set the originating remote IP address - which must be derived by headers
like X-Forwarded-For
(Wikipedia).MatsSocketServer.getMatsSocketSessions(boolean, String, String, String)
- go
read there for semantics.MatsSocketServer.getMatsSocketSessionsCount(boolean, String, String, String)
-
go read there for semantics.SessionAuthenticator.initialAuthentication(..)
or
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.IncomingAuthorizationAndAdapter
without forwarding to Mats.MatsSocketServer.ReplyAdapter
which 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.ClusterStoreAndForward
and which
cannot "hide" the situation if the data store doesn't work.Principal
and decide whether this message should be forwarded to the Mats fabric (or directly resolved, rejected
or denied).MatsSocketServer.IncomingAuthorizationAndAdapter
gets to work with when handling an incoming
MatsSocket message.MatsSocketServer.MatsSocketEnvelopeDto
which carries some metadata about the processing of the Envelope.data store
when gotten via
MatsSocketServer.getMatsSocketSessions(boolean, String, String, String)
(returning MatsSocketSessionDto
), or an ActiveMatsSocketSession
representing an active
MatsSocketSession connected to this node of the MatsSocketServer instance when gotten via
MatsSocketServer.getActiveMatsSocketSessions()
(returning ActiveMatsSocketSessionDto
),
or a LiveMatsSocketSession
which is an interface view over the actual live session
in the MatsSocketServer when gotten via MatsSocketServer.getLiveMatsSocketSessions()
.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.MatsSocketEnvelopeWithMetaDto
will 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.MatsSocketEnvelopeWithMetaDto
will 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 ClusterStoreAndForward_SQL_DbMigrations.getMigrationsLocation()
.MatsSocketServer
upon 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 ServerContainer
.ClusterStoreAndForward.StoredOutMessage.getDeliveryCount()
one up.ClusterStoreAndForward.getMessagesFromOutbox(String, int)
will again return messages that has
previously been marked as attempted delivered with ClusterStoreAndForward.outboxMessagesAttemptedDelivery(String, Collection)
.SEND
or 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
here
and
here
for 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.ActiveMatsSocketSession
on 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.storeMessageIdInInbox(String, String)
throwing ClusterStoreAndForward.MessageIdAlreadyExistsException
), the result from
the previous processing can be returned right away.