ObjectDeliverer Use Cases

This page explains how to choose a Protocol, PacketRule, and DeliveryBox for your goal, and describes the typical use cases. For detailed inputs and outputs of each node, see the Blueprint API Reference.

Choosing a protocol

GoalProtocolNotes
Deliver data reliablyTCP/IP server/clientRetransmission included. Choosing the division rule matters
Encrypt the communicationTCP/IP TLS server/clientv1.9.0 and later. Requires certificates
Send state every tick where some loss is acceptableUDP sender/receiverFast, no retransmission. Broadcast is available
Connect to a web systemWebSocket clientv1.7.0 and later. wss encryption and auto-reconnect
Communicate fast with an app on the same PCShared memoryWindows only. Does not use the network
Keep data in a fileFile writer/readerThe file remains after the app closes
Check event flow before implementingReflectionSends to itself. For debugging

The lifecycle is the same for every protocol: store the manager created with Create Object Deliverer Manager in a variable, pass a Protocol and a PacketRule (and optionally a DeliveryBox) to Start, receive results through the Connected/Disconnected/ReceiveData events, and call Close when finished.

Switching protocols

To change the protocol, replace only the protocol node passed to Start. Event bindings and receive handling stay as they are.

For example, to switch a TCP/IP server to a UDP sender, replace Create Protocol Tcp Ip Server with Create Protocol Udp Socket Sender.

Example Blueprint switched to the UDP sender protocol

In C++:

deliverer->Start(UProtocolFactory::CreateProtocolUdpSocketSender("192.168.0.100", 9099),
                 UPacketRuleFactory::CreatePacketRuleSizeBody());
Connecting the protocol and packet rule to the Start node

You can also create your own custom protocols.

The following sections describe each protocol.

TCP/IP server and client

This is the protocol for TCP/IP communication. TCP/IP supports one-to-many communication, so multiple clients can connect to a single server.

It includes packet retransmission, so sent messages are reliably delivered. However, when multiple packets are sent, they may arrive combined, or a single message may arrive split into parts. Because of this, we recommend a division rule other than Nodivision.

Example Blueprint configuration for the TCP/IP server protocol

Create Protocol Tcp Ip Server

ParameterDescription
PortPort number for the server to listen on

Create Protocol Tcp Ip Client

ParameterDescription
IpAddressIP address of the server
PortPort number of the server
RetryAutomatically retry if connection fails
Auto Connect After DisconnectAutomatically attempt to reconnect when disconnected

TCP/IP characteristics

ItemDescription
RetransmissionYes
Persistent connectionYes
Recommended division rulesFixedLength, Terminate, SizeBody (Nodivision is not suitable)
ReliabilityHigh
NotesPackets may arrive combined or split

UDP sender and receiver

This is the protocol for UDP communication. Unlike TCP/IP, UDP sends messages unilaterally to the receiver without a connection step.

It has no packet retransmission, so packets may not arrive depending on network conditions. In return, it offers better performance than TCP/IP. It is suitable for features such as sending state every tick, where occasional packet loss is acceptable.

Example Blueprint configuration for UDP send and receive protocols

Create Protocol Udp Socket Sender

ParameterDescription
IpAddressDestination IP address
PortDestination port number

Create Protocol Udp Socket Sender with Broadcast

ParameterDescription
IpAddressDestination IP address
PortDestination port number
Enable BroadcastEnable broadcast transmission

Create Protocol Udp Socket Receiver

ParameterDescription
Bound PortPort number to listen for incoming data

UDP characteristics

ItemDescription
RetransmissionNo
Persistent connectionNo
Recommended division rulesNodivision (other rules also work)
NotesPackets may be lost

WebSocket client

This is a WebSocket client that connects to WebSocket servers used by many web systems. Available since v1.7.0.

It supports encrypted communication with wss:// URLs in addition to ws://. Set Auto Reconnect enables automatic reconnection after disconnection, and Set Reconnect Delay sets the wait in seconds before reconnecting.

Example Blueprint configuration for the WebSocket client protocol

Create Protocol Web Socket Client

ParameterDescription
UrlWebSocket server URL (for example, ws://localhost:8080)

Create Protocol Web Socket Client with Protocols

ParameterDescription
UrlWebSocket server URL
ProtocolsList of sub-protocols

Create Protocol Web Socket Client with Headers

ParameterDescription
UrlWebSocket server URL
ProtocolsList of sub-protocols
HeadersList of custom headers

WebSocket characteristics

ItemDescription
RetransmissionYes
Persistent connectionYes
Recommended division rulesNodivision (other rules also work)

Shared memory

Shared memory creates a memory space shared by multiple applications, and writes and reads messages in that space.

Because it is not network communication, values can only be exchanged on the same PC. In return, it offers superior read/write speed compared to other methods, which makes it suitable for exchanging large messages.

The receiver has no way to know when data has been written, so it must periodically read the memory to check for new writes. ObjectDeliverer handles this automatically, so you normally do not need to be aware of it. When you read memory created by a third party, check which rules the other side uses.

Example Blueprint configuration for the shared memory protocol

Create Protocol Shared Memory

ParameterDescription
Shared Memory NameIdentifier for the shared memory
Shared Memory SizeShared memory size in bytes

Shared memory characteristics

ItemDescription
RetransmissionNo
Persistent connectionNo
Recommended division rulesFixedLength, Terminate, SizeBody (Nodivision is not suitable)
NotesWindows only
NotesThe receiver polls, so sent values may be skipped

File writer and reader

This protocol writes and reads messages to and from a specific file.

It behaves similarly to shared memory, but because it writes to an actual file, you can check the messages even after the application closes. It is suitable for use cases where you need to keep data.

Example Blueprint configuration for the file read/write protocols

Create Protocol Log Writer

ParameterDescription
File PathFile path to write to
Path Is AbsoluteWhether the file path is absolute

Create Protocol Log Reader

ParameterDescription
File PathFile path to read from
Path Is AbsoluteWhether the file path is absolute
Cut First IntervalWhether to skip the first read interval

File characteristics

ItemDescription
RetransmissionNo
Persistent connectionNo
Recommended division rulesFixedLength, Terminate, SizeBody (Nodivision is not suitable)
NotesThe receiver polls, so sent values may be skipped

Reflection

This protocol sends and receives messages on itself. When a message is sent, a receive event fires on the same instance. It cannot exchange messages with other instances.

It is mainly intended for debugging during development.

Example Blueprint configuration for the reflection protocol

Reflection characteristics

ItemDescription
RetransmissionNo
Persistent connectionNo
Recommended division rulesAny
NotesFor debugging

Encrypting with TLS/mTLS

This is an encrypted communication protocol that adds TLS on top of TCP/IP (v1.9.0 and later). Like plain TCP/IP it supports one-to-many communication, with encryption and certificate-based authentication.

Depending on your needs, you can choose configurations such as a self-signed certificate with public key pinning, a custom CA, or mutual TLS (mTLS). On the server side you specify the paths of the server certificate and private key files.

Example Blueprint configuration for the TLS protocols

Create Protocol Tcp Ip Server Tls

ParameterDescription
PortPort number for the server to listen on
CertPathPath to the server certificate file
KeyPathPath to the server private key file
Minimum ProtocolMinimum TLS version (higher versions are allowed)

Create Protocol Tcp Ip Client Tls

ParameterDescription
IpAddressHostname or IP address of the server
PortPort number of the server
RetryAutomatically retry if connection fails
Auto Connect After DisconnectAutomatically attempt to reconnect when disconnected
Minimum ProtocolMinimum TLS version (higher versions are allowed)

TCP/IP TLS characteristics

ItemDescription
RetransmissionYes
Persistent connectionYes
Recommended division rulesFixedLength, Terminate, SizeBody (Nodivision is not suitable)
ReliabilityHigh
NotesRequired options differ by certificate setup (CA/self-signed/pinning/mTLS)

For guidance on choosing TLS options, see the FAQ: TLS options by use case. Certificate verification and the trust policy are described in Data Formats and Production.

A sample TLS server that communicates with the ObjectDeliverer TLS client is published on GitHub at AyumaxSoft/TLSServerSample.

Switching the packet fragmentation rules

Protocols such as TCP/IP may split a single message into multiple packets or combine multiple messages into one packet. ObjectDeliverer solves this with packet division rules (PacketRule).

As with protocols, you specify the rule by replacing the node passed to Start.

ObjectDeliverer supports the following rules, and you can also create your own custom rules.

  • FixedLength
  • Terminate
  • SizeBody
  • Nodivision

The sender and the receiver must use the same rule. When communicating with a third-party program, check in advance which rule it uses.

FixedLength

FixedLength divides messages with a fixed length. The packet size is fixed for every transmission, which keeps the splitting logic simple. The limitation is that messages larger than the specified size cannot be sent.

Example Blueprint settings for the FixedLength rule

Create Packet Rule Fixed Length

ParameterDescription
Fixed SizeFixed packet size in bytes

Terminate

Terminate delimits messages using a specific value as the separator. Using a newline character as the separator is a common example. Message length can change dynamically, but the terminator must be searched for on every send, which slightly reduces performance.

If Terminate is not specified, the newline codes \r(0x0d)\n(0x0a) are used.

Example Blueprint settings for the Terminate rule

Create Packet Rule Terminate

ParameterDescription
TerminateTerminator sequence (delimiter). Newline codes are used when omitted

SizeBody

SizeBody embeds the message size at the beginning of each message. Message size stays dynamic and the splitting logic is relatively simple, giving good performance.

Example Blueprint settings for the SizeBody rule

Create Packet Rule Size Body

ParameterDescription
Size LengthNumber of bytes for the size header (1, 2, 4, 8)
Size Buffer EndianEndianness (Big or Little)

Nodivision

Nodivision treats each received packet as a single message without splitting or combining.

Example Blueprint settings for the Nodivision rule

Create Packet Rule Nodivision

ParameterDescription
NoneThis rule has no parameters

Switching the DeliveryBox

By default, ObjectDeliverer sends and receives byte arrays. By specifying a DeliveryBox, you can have data converted automatically to a chosen format, so you no longer convert data to a byte array manually each time.

Note

When using a DeliveryBox, note that sending and receiving go through the DeliveryBox instead of the ObjectDelivererManager.

Example Blueprint passing a DeliveryBox to Start

In C++:

auto deliverybox = UDeliveryBoxFactory::CreateObjectDeliveryBoxUsingJson(SampleObject::StaticClass());
deliverybox->Received.AddDynamic(this, &UMyClass::OnReceiveObject);

deliverer->Start(UProtocolFactory::CreateProtocolTcpIpServer(9099),
                 UPacketRuleFactory::CreatePacketRuleSizeBody(), deliverybox);

Sending also goes through the DeliveryBox.

Using the Send node of a DeliveryBox
auto message = NewObject<SampleMessage>();
deliveryBox->Send(message);

ObjectDeliverer supports the following DeliveryBoxes, and you can create your own custom DeliveryBox.

  • ObjectDeliveryBoxUsingJson
  • Utf8StringDeliveryBox

ObjectDeliveryBoxUsingJson

This DeliveryBox converts any user-defined UObject class to and from a JSON string.

Every class usable in Unreal Engine inherits from UObject, so many class instances can be sent and received as they are. Exchanging messages in JSON is a common approach in other programming languages, so this also works well for communicating with other applications.

Example Blueprint configuration for ObjectDeliveryBoxUsingJson

For how to choose the JSON serialization format (whether to include the class name), see the FAQ: using ObjectDeliveryBoxUsingJson.

Utf8StringDeliveryBox

This DeliveryBox sends and receives arbitrary strings as they are, using UTF-8 encoding.

Example Blueprint configuration for Utf8StringDeliveryBox