Interface ProxySender


public interface ProxySender
Sends messages and data across proxy network connections.

Usage example:

ProxySender proxySender = flectonePulse.get(ProxySender.class);

// Send message across proxy network
proxySender.send(MessageType.CHAT, eventMetadata);

// Send custom data to proxy
proxySender.send(sender, MessageType.CUSTOM, output -> {
    output.writeUTF("custom data");
}, UUID.randomUUID());
Since:
1.0.0
  • Method Details

    • send

      static void send(byte @NonNull [] data, @NonNull Consumer<byte[]> dataConsumer, @NonNull Consumer<UUID> backendJoinConfirm)
      Reads a message off the proxy channel and either forwards it on or handles it as a join confirmation.
      Parameters:
      data - the raw payload
      dataConsumer - forwards the payload to the servers that should see it
      backendJoinConfirm - receives the player id when the message is a join confirmation
    • send

      static void send(@NonNull ModuleName tag, @NonNull ProxyDataConsumer<DataOutputStream> outputConsumer, @NonNull Consumer<byte[]> dataConsumer)
      Encodes a message for the proxy channel and hands it to the transport.
      Parameters:
      tag - the module the message belongs to
      outputConsumer - writes the payload
      dataConsumer - receives the encoded bytes
    • send

      boolean send(@NonNull ModuleName moduleName, @NonNull EventMetadata eventMetadata, @NonNull MessageContext messageContext)
      Sends event metadata to proxy network.
      Parameters:
      moduleName - the type of message being sent
      eventMetadata - the event metadata containing sender and data
      messageContext - The message context containing sender details and unique message identifier
      Returns:
      true if message was sent to at least one proxy, false otherwise
    • send

      boolean send(@NonNull FEntity sender, @NonNull ModuleName tag)
      Sends a simple message to proxy network.
      Parameters:
      sender - the entity sending the message
      tag - the message type tag
      Returns:
      true if message was sent to at least one proxy, false otherwise
    • send

      boolean send(@NonNull FEntity sender, @NonNull ModuleName tag, @NonNull ProxyDataConsumer<DataOutputStream> outputConsumer)
      Sends a simple message to proxy network.
      Parameters:
      sender - the entity sending the message
      tag - the message type tag
      outputConsumer - consumer to write custom data to output stream
      Returns:
      true if message was sent to at least one proxy, false otherwise
    • send

      boolean send(@NonNull FEntity sender, @NonNull ModuleName tag, @NonNull ProxyDataConsumer<DataOutputStream> outputConsumer, @NonNull UUID metadataUUID)
      Sends custom data to proxy network.
      Parameters:
      sender - the entity sending the data
      tag - the message type tag
      outputConsumer - consumer to write custom data to output stream
      metadataUUID - unique identifier for this metadata
      Returns:
      true if data was sent to at least one proxy, false otherwise