Enum GatewayOpcode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<GatewayOpcode>

    public enum GatewayOpcode
    extends java.lang.Enum<GatewayOpcode>
    An enum with all gateway opcode as defined by Discord.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DISPATCH
      Dispatches an event.
      HEARTBEAT
      Used for ping checking.
      HEARTBEAT_ACK
      Sent immediately following a client heartbeat that was received.
      HELLO
      Sent immediately after connecting, contains heartbeat and server debug information.
      IDENTIFY
      Used for client handshake.
      INVALID_SESSION
      Used to notify client they have an invalid session id.
      RECONNECT
      Used to tell clients to reconnect to the gateway.
      REQUEST_GUILD_MEMBERS
      Used to request guild members.
      RESUME
      Used to resume a closed connection.
      STATUS_UPDATE
      Used to update the client status.
      VOICE_SERVER_PING
      Used for voice ping checking.
      VOICE_STATE_UPDATE
      Used to join/move/leave voice channels.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Optional<GatewayOpcode> fromCode​(int code)
      Gets the gateway opcode by actual numeric code.
      int getCode()
      Gets the actual numeric code.
      static GatewayOpcode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static GatewayOpcode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

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

      • DISPATCH

        public static final GatewayOpcode DISPATCH
        Dispatches an event.
      • HEARTBEAT

        public static final GatewayOpcode HEARTBEAT
        Used for ping checking.
      • IDENTIFY

        public static final GatewayOpcode IDENTIFY
        Used for client handshake.
      • STATUS_UPDATE

        public static final GatewayOpcode STATUS_UPDATE
        Used to update the client status.
      • VOICE_STATE_UPDATE

        public static final GatewayOpcode VOICE_STATE_UPDATE
        Used to join/move/leave voice channels.
      • VOICE_SERVER_PING

        public static final GatewayOpcode VOICE_SERVER_PING
        Used for voice ping checking.
      • RESUME

        public static final GatewayOpcode RESUME
        Used to resume a closed connection.
      • RECONNECT

        public static final GatewayOpcode RECONNECT
        Used to tell clients to reconnect to the gateway.
      • REQUEST_GUILD_MEMBERS

        public static final GatewayOpcode REQUEST_GUILD_MEMBERS
        Used to request guild members.
      • INVALID_SESSION

        public static final GatewayOpcode INVALID_SESSION
        Used to notify client they have an invalid session id.
      • HELLO

        public static final GatewayOpcode HELLO
        Sent immediately after connecting, contains heartbeat and server debug information.
      • HEARTBEAT_ACK

        public static final GatewayOpcode HEARTBEAT_ACK
        Sent immediately following a client heartbeat that was received.
    • Method Detail

      • values

        public static GatewayOpcode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (GatewayOpcode c : GatewayOpcode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static GatewayOpcode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • fromCode

        public static java.util.Optional<GatewayOpcode> fromCode​(int code)
        Gets the gateway opcode by actual numeric code.
        Parameters:
        code - The actual numeric code.
        Returns:
        The gateway opcode with the actual numeric code.
      • getCode

        public int getCode()
        Gets the actual numeric code.
        Returns:
        The actual numeric code.