Class OutgoingSocketMessageEvent

java.lang.Object
de.craftsblock.craftscore.event.Event
de.craftsblock.craftscore.event.CancellableEvent
de.craftsblock.craftsnet.events.sockets.message.OutgoingSocketMessageEvent
All Implemented Interfaces:
de.craftsblock.craftscore.event.Cancellable, GenericSocketEventBase, GenericSocketMessageEventBase

public class OutgoingSocketMessageEvent extends de.craftsblock.craftscore.event.CancellableEvent implements GenericSocketMessageEventBase
The OutgoingSocketMessageEvent class represents an event related to an outgoing message on a websocket connection. It extends the base CancellableEvent to support event cancellation.
Since:
2.1.1-SNAPSHOT
See Also:
  • Constructor Details

    • OutgoingSocketMessageEvent

      public OutgoingSocketMessageEvent(@NotNull @NotNull SocketExchange exchange, @NotNull @NotNull Frame frame)
      Constructs a new OutgoingSocketMessageEvent with the specified SocketExchange and message data.
      Parameters:
      exchange - The SocketExchange object representing the socket connection and its associated data.
      frame - The Frame that contains the message information.
  • Method Details

    • getExchange

      @NotNull public @NotNull SocketExchange getExchange()
      Gets the SocketExchange which stores the involved client, server and some other data.
      Specified by:
      getExchange in interface GenericSocketEventBase
      Returns:
      The SocketExchange.
    • getFrame

      @NotNull public @NotNull Frame getFrame()
      Gets the incoming message as a Frame object.
      Specified by:
      getFrame in interface GenericSocketMessageEventBase
      Returns:
      The incoming message.
    • setOpcode

      public void setOpcode(@NotNull @NotNull Opcode opcode)
      Sets the opcode used to send the data.
      Parameters:
      opcode - The opcode which should be used.
    • setData

      public void setData(byte @NotNull [] data)
      Sets the outgoing message data for the event.
      Parameters:
      data - The outgoing message data to be set.
    • setFrame

      public void setFrame(@NotNull @NotNull Frame frame)
      Sets the outgoing message frame.
      Parameters:
      frame - The outgoing message frame.