Class ProxySender

java.lang.Object
net.flectone.pulse.platform.sender.ProxySender

public class ProxySender extends Object
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
  • Constructor Details

  • Method Details

    • send

      public static void send(byte @NonNull [] data, @NonNull Consumer<byte[]> dataConsumer, @NonNull Consumer<UUID> backendJoinConfirm)
    • send

      public static void send(@NonNull ModuleName tag, @NonNull ProxyDataConsumer<DataOutputStream> outputConsumer, @NonNull Consumer<byte[]> dataConsumer)
    • send

      public boolean send(@NonNull ModuleName moduleName, @NonNull EventMetadata<?> eventMetadata)
      Sends event metadata to proxy network.
      Parameters:
      moduleName - the type of message being sent
      eventMetadata - the event metadata containing sender and data
      Returns:
      true if message was sent to at least one proxy, false otherwise
    • send

      public 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

      public boolean send(@NonNull FEntity sender, @NonNull ModuleName tag, @NonNull ProxyDataConsumer<SafeDataOutputStream> 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

      public boolean send(@NonNull FEntity sender, @NonNull ModuleName tag, @NonNull ProxyDataConsumer<SafeDataOutputStream> 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