Enum Class MatsSocketServer.MessageType

java.lang.Object
java.lang.Enum<MatsSocketServer.MessageType>
io.mats3.matssocket.MatsSocketServer.MessageType
All Implemented Interfaces:
Serializable, Comparable<MatsSocketServer.MessageType>, Constable
Enclosing interface:
MatsSocketServer

public static enum MatsSocketServer.MessageType extends Enum<MatsSocketServer.MessageType>
All Message Types (aka MatsSocket Envelope Types) used in the wire-protocol of MatsSocket.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The specified message was Received, and acknowledged positively - i.e.
    An "Acknowledge ^ 2", i.e.
    From Client: The client can use a separate AUTH message to send over the requested REAUTH (it could just as well put the 'auth' in a PING or any other message it had pending).
    A HELLO message must be part of the first Pipeline of messages, preferably alone.
    The specified message was Received, but it did not acknowledge it - i.e.
    A PING, to which a PONG is expected.
    A Reply to a PING.
    Topic message from Server: A message is issued on Topic, the TopicId is specified in 'eid', while the message is in 'msg'.
    The server requests that the Client re-authenticates, where the Client should immediately get a fresh authentication and send it back using either any message it has pending, or in a separate AUTH message.
    A REJECT-reply to a previous REQUEST - if the Client did the REQUEST, the Server will answer with either a REJECT or RESOLVE.
    The sender initiates a request, to which a RESOLVE or REJECT message is expected.
    A RESOLVE-reply to a previous REQUEST - if the Client did the REQUEST, the Server will answer with either a RESOLVE or REJECT.
    The sender should retry the message (the receiver could not handle it right now, but a Retry might fix it).
    The sender sends a "fire and forget" style message.
    Request from Client: The Client want to subscribe to a Topic, the TopicId is specified in 'eid'.
    Reply from Server: Subscription went OK, but you've lost messages: The messageId that was referenced in the SUB was not known to the server, implying that there are at least one message that has expired, but we don't know whether it was 1 or 1 million - so you won't get any of them "replayed".
    Reply from Server: Subscription was not authorized - no messages for this Topic will be delivered.
    Reply from Server: Subscription was OK.
    Request from Client: The Client want to unsubscribe from a Topic, the TopicId is specified in 'eid'.
    The reply to a HELLO, where the MatsSocketSession is established, and the MatsSocketSessionId is returned.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • HELLO

      public static final MatsSocketServer.MessageType HELLO
      A HELLO message must be part of the first Pipeline of messages, preferably alone. One of the messages in the first Pipeline must have the "auth" field set, and it might as well be the HELLO.
    • WELCOME

      public static final MatsSocketServer.MessageType WELCOME
      The reply to a HELLO, where the MatsSocketSession is established, and the MatsSocketSessionId is returned. If you included a MatsSocketSessionId in the HELLO, signifying that you want to reconnect to an existing session, and you actually get a WELCOME back, it will be the same as what you provided - otherwise the connection is closed with MatsSocketServer.MatsSocketCloseCodes.SESSION_LOST.
    • SEND

      public static final MatsSocketServer.MessageType SEND
      The sender sends a "fire and forget" style message.
    • REQUEST

      public static final MatsSocketServer.MessageType REQUEST
      The sender initiates a request, to which a RESOLVE or REJECT message is expected.
    • RETRY

      public static final MatsSocketServer.MessageType RETRY
      The sender should retry the message (the receiver could not handle it right now, but a Retry might fix it).
    • ACK

      public static final MatsSocketServer.MessageType ACK
      The specified message was Received, and acknowledged positively - i.e. the other party has decided to process it.

      The sender of the ACK has now taken over responsibility of the specified message, put it (at least the reference ClientMessageId) in its Inbox, and possibly started processing it. The reason for the Inbox is so that if it Receives the message again, it may just insta-ACK/NACK it and toss this copy out the window (since it has already handled it).

      When an ACK is received, the receiver may safely delete the acknowledged message from its Outbox.

    • NACK

      public static final MatsSocketServer.MessageType NACK
      The specified message was Received, but it did not acknowledge it - i.e. the other party has decided to NOT process it.

      The sender of the NACK has now taken over responsibility of the specified message, put it (at least the reference Client/Server MessageId) in its Inbox - but has evidently decided not to process it. The reason for the Inbox is so that if it Receives the message again, it may just insta-ACK/NACK it and toss this copy out the window (since it has already handled it).

      When an NACK is received, the receiver may safely delete the acknowledged message from its Outbox.

    • ACK2

      public static final MatsSocketServer.MessageType ACK2
      An "Acknowledge ^ 2", i.e. an acknowledge of the ACK or NACK. When the receiver gets this, it may safely delete the entry it has for the specified message from its Inbox.

      The message is now fully transferred from one side to the other, and both parties again has no reference to this message in their Inbox and Outbox.

    • RESOLVE

      public static final MatsSocketServer.MessageType RESOLVE
      A RESOLVE-reply to a previous REQUEST - if the Client did the REQUEST, the Server will answer with either a RESOLVE or REJECT.
    • REJECT

      public static final MatsSocketServer.MessageType REJECT
      A REJECT-reply to a previous REQUEST - if the Client did the REQUEST, the Server will answer with either a REJECT or RESOLVE.
    • SUB

      public static final MatsSocketServer.MessageType SUB
      Request from Client: The Client want to subscribe to a Topic, the TopicId is specified in 'eid'.
    • UNSUB

      public static final MatsSocketServer.MessageType UNSUB
      Request from Client: The Client want to unsubscribe from a Topic, the TopicId is specified in 'eid'.
    • SUB_OK

      public static final MatsSocketServer.MessageType SUB_OK
      Reply from Server: Subscription was OK. If this is a reconnect, this indicates that any messages that was lost "while offline" will now be delivered/"replayed".
    • SUB_LOST

      public static final MatsSocketServer.MessageType SUB_LOST
      Reply from Server: Subscription went OK, but you've lost messages: The messageId that was referenced in the SUB was not known to the server, implying that there are at least one message that has expired, but we don't know whether it was 1 or 1 million - so you won't get any of them "replayed". You must therefore "get up to speed" by other means, e.g. if the subscription in question is some kind of cache delta-update mechanism, you will now have to reload the entire cache.
    • SUB_NO_AUTH

      public static final MatsSocketServer.MessageType SUB_NO_AUTH
      Reply from Server: Subscription was not authorized - no messages for this Topic will be delivered.
    • PUB

      public static final MatsSocketServer.MessageType PUB
      Topic message from Server: A message is issued on Topic, the TopicId is specified in 'eid', while the message is in 'msg'.
    • REAUTH

      public static final MatsSocketServer.MessageType REAUTH
      The server requests that the Client re-authenticates, where the Client should immediately get a fresh authentication and send it back using either any message it has pending, or in a separate AUTH message. Message processing - both processing of received messages, and sending of outgoing messages (i.e. Replies to REQUESTs, or Server-initiated SENDs and REQUESTs) will be stalled until such auth is gotten.
    • AUTH

      public static final MatsSocketServer.MessageType AUTH
      From Client: The client can use a separate AUTH message to send over the requested REAUTH (it could just as well put the 'auth' in a PING or any other message it had pending).
    • PING

      public static final MatsSocketServer.MessageType PING
      A PING, to which a PONG is expected.
    • PONG

      public static final MatsSocketServer.MessageType PONG
      A Reply to a PING.
  • Method Details

    • values

      public static MatsSocketServer.MessageType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MatsSocketServer.MessageType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null