Class ProxySender
java.lang.Object
net.flectone.pulse.platform.sender.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
-
Constructor Summary
ConstructorsConstructorDescriptionProxySender(ProxyRegistry proxyRegistry, FileFacade fileFacade, MessagePipeline messagePipeline, PlatformServerAdapter platformServerAdapter, com.google.gson.Gson gson, FLogger fLogger) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidsend(byte @NonNull [] data, @NonNull Consumer<byte[]> dataConsumer, @NonNull Consumer<UUID> backendJoinConfirm) booleansend(@NonNull FEntity sender, @NonNull ModuleName tag) Sends a simple message to proxy network.booleansend(@NonNull FEntity sender, @NonNull ModuleName tag, @NonNull ProxyDataConsumer<SafeDataOutputStream> outputConsumer) Sends a simple message to proxy network.booleansend(@NonNull FEntity sender, @NonNull ModuleName tag, @NonNull ProxyDataConsumer<SafeDataOutputStream> outputConsumer, @NonNull UUID metadataUUID) Sends custom data to proxy network.booleansend(@NonNull ModuleName moduleName, @NonNull EventMetadata<?> eventMetadata) Sends event metadata to proxy network.static voidsend(@NonNull ModuleName tag, @NonNull ProxyDataConsumer<DataOutputStream> outputConsumer, @NonNull Consumer<byte[]> dataConsumer)
-
Constructor Details
-
ProxySender
@Inject public ProxySender(ProxyRegistry proxyRegistry, FileFacade fileFacade, MessagePipeline messagePipeline, PlatformServerAdapter platformServerAdapter, com.google.gson.Gson gson, FLogger fLogger)
-
-
Method Details
-
send
-
send
public static void send(@NonNull ModuleName tag, @NonNull ProxyDataConsumer<DataOutputStream> outputConsumer, @NonNull Consumer<byte[]> dataConsumer) -
send
Sends event metadata to proxy network.- Parameters:
moduleName- the type of message being senteventMetadata- the event metadata containing sender and data- Returns:
- true if message was sent to at least one proxy, false otherwise
-
send
Sends a simple message to proxy network.- Parameters:
sender- the entity sending the messagetag- 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 messagetag- the message type tagoutputConsumer- 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 datatag- the message type tagoutputConsumer- consumer to write custom data to output streammetadataUUID- unique identifier for this metadata- Returns:
- true if data was sent to at least one proxy, false otherwise
-