Record Class ReconnectQuery

java.lang.Object
java.lang.Record
com.iizix.comm.session.ReconnectQuery
Record Components:
sessionID - The session identifier the client comes back to, never empty.
serial - The next serial number the client expects to receive, 1 to 0xFFFF.
token - The reconnect token the client presented, null when the query carries none.

public record ReconnectQuery(String sessionID, int serial, String token) extends Record
The query of a WebSocket reconnection, reconnect=<session ID>&serial=<next serial>[&rt=<reconnect token>], parsed once for every end point constructor that accepts reconnections (the client's and VSViewer's), so that both read it the same way (CC-FIX-RECONNECT-TOKEN). Before, each cut the serial as everything after &serial=, and a member after it made the serial unreadable and the reconnection unhandled.

The members are read by name, in any order; a name that is none of the three is ignored. The serial must be a decimal number from 1 to 65535. The token is kept as it came: hex characters of the server's own making, compared by the session's manager in constant time; a client older than v5.1 sends none (token null, SH-D-2).

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of the session identifier member, reconnect: the query of a reconnection starts with it.
    static final String
    The name of the serial member, serial.
    static final String
    The name of the reconnect token member, rt: masked in every log, as the password members are.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReconnectQuery(String sessionID, int serial, String token)
    Creates an instance of a ReconnectQuery record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    parse(String query)
    Parses the query of a WebSocket upgrade as a reconnection.
    int
    Returns the value of the serial record component.
    Returns the value of the sessionID record component.
    Returns the value of the token record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • RECONNECT

      public static final String RECONNECT
      The name of the session identifier member, reconnect: the query of a reconnection starts with it.
      See Also:
    • SERIAL

      public static final String SERIAL
      The name of the serial member, serial.
      See Also:
    • TOKEN

      public static final String TOKEN
      The name of the reconnect token member, rt: masked in every log, as the password members are.
      See Also:
  • Constructor Details

    • ReconnectQuery

      public ReconnectQuery(String sessionID, int serial, String token)
      Creates an instance of a ReconnectQuery record class.
      Parameters:
      sessionID - the value for the sessionID record component
      serial - the value for the serial record component
      token - the value for the token record component
  • Method Details

    • parse

      public static ReconnectQuery parse(String query)
      Parses the query of a WebSocket upgrade as a reconnection.
      Parameters:
      query - The query, without the question mark, null for none.
      Returns:
      The reconnection, or null when the query is not one: it does not start with reconnect=, the identifier is empty, the serial is missing or not a number from 1 to 65535.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sessionID

      public String sessionID()
      Returns the value of the sessionID record component.
      Returns:
      the value of the sessionID record component
    • serial

      public int serial()
      Returns the value of the serial record component.
      Returns:
      the value of the serial record component
    • token

      public String token()
      Returns the value of the token record component.
      Returns:
      the value of the token record component