Skip to content

EntropyEngine::Networking

Name
EntropyEngine::Networking::Wire
EntropyEngine::Networking::WebDAV
EntropyEngine::Networking::SharedMemory
EntropyEngine::Networking::HTTP
Name
structEntropyEngine::Networking::WebRTCServerConfig
Configuration for WebRTC-specific settings.
classEntropyEngine::Networking::WebRTCServer
WebRTC-based implementation of RemoteServer.
classEntropyEngine::Networking::WebRTCConnection
WebRTC-based network connection using data channels.
structEntropyEngine::Networking::WebRTCConfig
WebRTC-specific configuration.
classEntropyEngine::Networking::WebDavAdapter
VFS-to-WebDAV adapter for HTTP server integration.
classEntropyEngine::Networking::UnixSocketServer
Unix domain socket server implementation.
classEntropyEngine::Networking::UnixSocketConnection
Unix domain socket implementation for local IPC.
struct[EntropyEngine::Networking::TypeToPropertyType< uint64_t >](/api/EntropyEngine/Networking/TypeToPropertyType< uint64_t >/)
struct[EntropyEngine::Networking::TypeToPropertyType< std::vector< uint8_t > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< uint8_t > >/)
struct[EntropyEngine::Networking::TypeToPropertyType< std::vector< uint64_t > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< uint64_t > >/)
struct[EntropyEngine::Networking::TypeToPropertyType< std::vector< int64_t > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< int64_t > >/)
struct[EntropyEngine::Networking::TypeToPropertyType< std::vector< int32_t > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< int32_t > >/)
struct[EntropyEngine::Networking::TypeToPropertyType< std::vector< float > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< float > >/)
struct[EntropyEngine::Networking::TypeToPropertyType< std::vector< Vec3 > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< Vec3 > >/)
struct[EntropyEngine::Networking::TypeToPropertyType< std::string >](/api/EntropyEngine/Networking/TypeToPropertyType< std/string >/)
struct[EntropyEngine::Networking::TypeToPropertyType< int64_t >](/api/EntropyEngine/Networking/TypeToPropertyType< int64_t >/)
struct[EntropyEngine::Networking::TypeToPropertyType< int32_t >](/api/EntropyEngine/Networking/TypeToPropertyType< int32_t >/)
struct[EntropyEngine::Networking::TypeToPropertyType< float >](/api/EntropyEngine/Networking/TypeToPropertyType< float >/)
struct[EntropyEngine::Networking::TypeToPropertyType< double >](/api/EntropyEngine/Networking/TypeToPropertyType< double >/)
struct[EntropyEngine::Networking::TypeToPropertyType< bool >](/api/EntropyEngine/Networking/TypeToPropertyType< bool >/)
struct[EntropyEngine::Networking::TypeToPropertyType< Vec4 >](/api/EntropyEngine/Networking/TypeToPropertyType< Vec4 >/)
struct[EntropyEngine::Networking::TypeToPropertyType< Vec3 >](/api/EntropyEngine/Networking/TypeToPropertyType< Vec3 >/)
struct[EntropyEngine::Networking::TypeToPropertyType< Vec2 >](/api/EntropyEngine/Networking/TypeToPropertyType< Vec2 >/)
struct[EntropyEngine::Networking::TypeToPropertyType< T >](/api/EntropyEngine/Networking/TypeToPropertyType< T >/)
struct[EntropyEngine::Networking::TypeToPropertyType< Quat >](/api/EntropyEngine/Networking/TypeToPropertyType< Quat >/)
structEntropyEngine::Networking::TypeToPropertyType
Compile-time mapping from C++ types to PropertyType enum.
structEntropyEngine::Networking::SignalingCallbacks
WebRTC signaling callbacks.
classEntropyEngine::Networking::SharedMemoryServer
Server for accepting shared memory connections.
classEntropyEngine::Networking::SharedMemoryConnection
Shared memory implementation for high-performance local IPC.
classEntropyEngine::Networking::SessionManager
Slot-based session manager for protocol-level operations.
classEntropyEngine::Networking::SessionHandle
EntropyObject-stamped handle for network sessions.
classEntropyEngine::Networking::SchemaNackTracker
Tracks schema NACKs with rate limiting and metrics.
structEntropyEngine::Networking::SchemaNackPolicy
Global, thread-safe policy for schema NACK behavior.
struct[EntropyEngine::Networking::Result< void >](/api/EntropyEngine/Networking/Result< void >/)
Result specialization for void operations.
structEntropyEngine::Networking::Result
Result type for operations that may fail.
structEntropyEngine::Networking::RemoteServerConfig
Configuration for remote server connections.
classEntropyEngine::Networking::RemoteServer
Abstract base class for remote server connections.
classEntropyEngine::Networking::PropertyRegistry
Thread-safe global property registry.
structEntropyEngine::Networking::PropertyMetadata
Metadata for a registered property instance.
structEntropyEngine::Networking::PropertyHash
128-bit property hash for per-instance property identification
structEntropyEngine::Networking::PropertyDefinition
Property definition within a component schema.
classEntropyEngine::Networking::NetworkSession
NetworkSession - High-level session that manages a peer connection.
classEntropyEngine::Networking::NetworkConnection
Abstract base interface for network connections.
classEntropyEngine::Networking::NamedPipeServer
Windows named pipe server implementation.
classEntropyEngine::Networking::NamedPipeConnection
Windows named pipe implementation for local IPC.
structEntropyEngine::Networking::LocalServerConfig
Local server configuration (platform-agnostic).
classEntropyEngine::Networking::LocalServer
Platform-agnostic local server for accepting IPC connections.
structEntropyEngine::Networking::HttpResponseLite
Minimal HTTP response representation for WebDAV operations.
structEntropyEngine::Networking::HttpRequestLite
Minimal HTTP request representation for WebDAV operations.
structEntropyEngine::Networking::ConnectionStats
Connection statistics.
classEntropyEngine::Networking::ConnectionManager
Slot-based connection manager with platform-agnostic API.
classEntropyEngine::Networking::ConnectionHandle
EntropyObject-stamped handle for network connections.
structEntropyEngine::Networking::ConnectionConfig
Unified connection configuration.
classEntropyEngine::Networking::ComponentSchemaRegistry
Thread-safe registry for component schemas.
structEntropyEngine::Networking::ComponentSchema
Component schema definition.
classEntropyEngine::Networking::BatchManager
Batches high-frequency property updates for efficient network transmission.
structEntropyEngine::Networking::AssetId
Content-addressed asset identifier using SHA-256.
Name
using glm::vec4Vec4
4D vector type (GLM)
using glm::vec3Vec3
3D vector type (GLM)
using glm::vec2Vec2
2D vector type (GLM)
using std::stringTypeName
Type name for entities.
enum class uint8_tSignalingMessageType { SDP = 0x01, SDP = 0x01, ICE = 0x02, ICE = 0x02}
enum class uint8_tSignalingMessageType { SDP = 0x01, SDP = 0x01, ICE = 0x02, ICE = 0x02}
using uint32_tRequestId
Request identifier for control messages.
using glm::quatQuat
Quaternion type for rotations (GLM).
using std::variant< int32_t, int64_t, float, double, Vec2, Vec3, Vec4, Quat, std::string, bool, std::vector< uint8_t >, std::vector< int32_t >, std::vector< int64_t >, std::vector< float >, std::vector< double >, std::vector< Vec2 >, std::vector< Vec3 >, std::vector< Vec4 >, std::vector< Quat >, AssetId, std::vector< AssetId >, Mat3, Mat4 >PropertyValue
Type-safe variant for property values.
enum classPropertyType { Vec4Array, Vec4, Vec3Array, Vec3, Vec2Array, Vec2, TextureCubeArray, TextureCube, Texture3D, Texture2DArray, Texture2D, Texture1D, String, Sampler, QuatArray, Quat, Mat4, Mat3, Int64Array, Int64, Int32Array, Int32, Float64Array, Float64, Float32Array, Float32, Bytes, Bool, AssetIdArray, AssetId}
Property type enumeration.
enum classNetworkError { WouldBlock, UnknownProperty, TypeMismatch, Timeout, SharedMemorySizeMismatch, SharedMemoryPermission, SharedMemoryNotAvailable, SharedMemoryCorrupted, SerializationFailed, SchemaValidationFailed, SchemaNotPublic, SchemaNotFound, SchemaIncompatible, SchemaAlreadyExists, ResourceLimitExceeded, RegistryFull, None, InvalidParameter, InvalidMessage, HashCollision, HandshakeFailed, EntityNotFound, DeserializationFailed, DecompressionFailed, ConnectionClosed, CompressionFailed, AlreadyExists}
Error codes for networking operations.
using glm::mat4Mat4
4x4 matrix type (GLM, column-major)
using glm::mat3Mat3
3x3 matrix type (GLM, column-major)
using uint64_tEntityId
Unique identifier for entities in the scene.
enum classConnectionType { Remote, Local}
High-level connection type abstraction.
enum classConnectionState { Failed, Disconnecting, Disconnected, Connecting, Connected}
Connection state during lifecycle.
enum classConnectionBackend { XPC, WebRTC, UnixSocket, SharedMemory, NamedPipe, Auto}
Explicit backend selection (advanced use).
using PropertyHashComponentTypeHash
Type alias for component type identification.
using Protocol::PropertyValueCapnpPropertyValue
Serialization helpers for ComponentSchema ↔ Cap’n Proto.
using Protocol::PropertyTypeCapnpPropertyType
using std::stringAppId
Application identifier.
Name
boolvalidatePropertyType(const PropertyValue & value, PropertyType expectedType)
Validate that a property value matches the expected type.
std::stringtoString(const PropertyHash & hash)
Convert PropertyHash to string for logging/diagnostics.
uint16_ttoCapnpPropertyType(PropertyType type)
Convert C++ PropertyType to Cap’n Proto PropertyType enum.
voidserializePropertyValue(const PropertyValue & value, CapnpPropertyValue::Builder builder)
Serialize a PropertyValue to Cap’n Proto.
voidserializePropertyDefinition(const PropertyDefinition & definition, Protocol::PropertyDefinitionData::Builder builder)
Serialize a PropertyDefinition to Cap’n Proto.
voidserializeComponentSchema(const ComponentSchema & schema, Protocol::ComponentSchemaData::Builder builder)
Serialize a ComponentSchema to Cap’n Proto.
Result< std::vector< uint8_t > >serialize(capnp::MessageBuilder & builder)
Serialize a Cap’n Proto message to a byte vector.
const char *rtcStateToString(rtcState s)
const char *propertyTypeToString(PropertyType type)
Convert PropertyType to human-readable string.
std::optional< PropertyType >mapTypeIdToPropertyType(TypeID typeId)
Runtime mapping from TypeID to PropertyType.
booliequal_prefix(std::string_view a, std::string_view b)
PropertyTypegetPropertyType(const PropertyValue & value)
Get the PropertyType for a PropertyValue variant.
size_tgetPropertySize(PropertyType type)
Get the minimum required size in bytes for a property type.
size_tgetFieldSize(TypeID typeId)
Runtime field size lookup.
uint64_tgetCurrentTimestampMicros()
Get current timestamp in microseconds since epoch.
template <typename T >
Result< ComponentSchema >
generateComponentSchema(const std::string & appId, uint32_t schemaVersion, bool isPublic =true)
Auto-generate ComponentSchema from TypeInfo reflection.
PropertyTypefromCapnpPropertyType(uint16_t capnpType)
Convert Cap’n Proto PropertyType to C++ PropertyType enum.
const char *errorToString(NetworkError error)
Convert error code to human-readable string.
voidencodeU32BigEndian(uint32_t value, uint8_t * dest)
voidencodeU32BigEndian(uint32_t value, uint8_t * dest)
std::vector< uint8_t >encodeSDPMessage(const std::string & type, const std::string & sdp)
std::vector< uint8_t >encodeSDPMessage(const std::string & type, const std::string & sdp)
std::vector< uint8_t >encodeICEMessage(const std::string & candidate, const std::string & mid)
std::vector< uint8_t >encodeICEMessage(const std::string & candidate, const std::string & mid)
PropertyValuedeserializePropertyValue(CapnpPropertyValue::Reader reader)
Deserialize a PropertyValue from Cap’n Proto.
PropertyDefinitiondeserializePropertyDefinition(Protocol::PropertyDefinitionData::Reader reader)
Deserialize a PropertyDefinition from Cap’n Proto.
Result< ComponentSchema >deserializeComponentSchema(Protocol::ComponentSchemaData::Reader reader)
Deserialize a ComponentSchema from Cap’n Proto.
Result< kj::Array< capnp::word > >deserialize(const std::vector< uint8_t > & buffer)
Deserialize a byte vector to a Cap’n Proto message.
Result< std::vector< uint8_t > >decompress(const std::vector< uint8_t > & compressedData)
Decompress zstd-compressed data.
uint32_tdecodeU32BigEndian(const uint8_t * src)
uint32_tdecodeU32BigEndian(const uint8_t * src)
std::optional< std::tuple< SignalingMessageType, std::string, std::string > >decodeSignalingMessage(const std::vector< uint8_t > & data)
std::optional< std::tuple< SignalingMessageType, std::string, std::string > >decodeSignalingMessage(const std::vector< uint8_t > & data)
std::unique_ptr< SharedMemoryServer >createSharedMemoryServer(ConnectionManager * connMgr, const std::string & baseName)
Creates a shared memory server.
std::unique_ptr< SharedMemoryServer >createSharedMemoryServer(ConnectionManager * connMgr, const std::string & baseName, const SharedMemoryServer::Config & config)
Creates a shared memory server with configuration.
std::unique_ptr< RemoteServer >createRemoteServer(ConnectionManager * connMgr, uint16_t port =8080)
Create a remote server with default configuration.
std::unique_ptr< RemoteServer >createRemoteServer(ConnectionManager * connMgr, const RemoteServerConfig & config)
Create a remote server with custom configuration.
std::unique_ptr< LocalServer >createLocalServer(ConnectionManager * connMgr, const std::string & endpoint)
Creates a platform-appropriate LocalServer instance.
std::unique_ptr< LocalServer >createLocalServer(ConnectionManager * connMgr, const std::string & endpoint, const LocalServerConfig & config)
Creates a LocalServer with configuration options.
const char *connStateToString(ConnectionState s)
PropertyHashcomputePropertyHash(uint64_t entityId, ComponentTypeHash componentType, const std::string & propertyName)
Compute property hash from components.
Result< std::vector< uint8_t > >compress(const std::vector< uint8_t > & data, int compressionLevel =3)
Compress data using zstd.
template NetworkSession::ComponentHandle &NetworkSession::ComponentHandle::set< std::string >(const std::string & , const std::string & )
Name
size_tDEFAULT_XPC_MAX_MESSAGE_SIZE
intDEFAULT_WEBRTC_MAX_MESSAGE_SIZE
size_tDEFAULT_SHARED_MEMORY_REGION_SIZE
size_tDEFAULT_MAX_MESSAGE_SIZE
using EntropyEngine::Networking::Vec4 = glm::vec4;

4D vector type (GLM)

using EntropyEngine::Networking::Vec3 = glm::vec3;

3D vector type (GLM)

using EntropyEngine::Networking::Vec2 = glm::vec2;

2D vector type (GLM)

using EntropyEngine::Networking::TypeName = std::string;

Type name for entities.

Identifies the class/type of an entity within an application.

EnumeratorValueDescription
SDP0x01
SDP0x01
ICE0x02
ICE0x02
EnumeratorValueDescription
SDP0x01
SDP0x01
ICE0x02
ICE0x02
using EntropyEngine::Networking::RequestId = uint32_t;

Request identifier for control messages.

Used to correlate requests and responses in the control plane.

using EntropyEngine::Networking::Quat = glm::quat;

Quaternion type for rotations (GLM).

using EntropyEngine::Networking::PropertyValue = std::variant<int32_t, int64_t, float, double, Vec2, Vec3, Vec4, Quat, std::string, bool,
std::vector<uint8_t>,
std::vector<int32_t>, std::vector<int64_t>, std::vector<float>, std::vector<double>,
std::vector<Vec2>, std::vector<Vec3>, std::vector<Vec4>, std::vector<Quat>,
AssetId, std::vector<AssetId>,
Mat3, Mat4>;

Type-safe variant for property values.

Holds any of the supported property types in a type-safe manner. Includes scalar types and array types.

EnumeratorValueDescription
Vec4Array
Vec4
Vec3Array
Vec3
Vec2Array
Vec2
TextureCubeArray
TextureCube
Texture3D
Texture2DArray
Texture2D
Texture1D
String
Sampler
QuatArray
Quat
Mat4
Mat3
Int64Array
Int64
Int32Array
Int32
Float64Array
Float64
Float32Array
Float32
Bytes
Bool
AssetIdArray
AssetId

Property type enumeration.

Matches the PropertyType enum in entropy.capnp

EnumeratorValueDescription
WouldBlockOperation would block (non-blocking backpressure).
UnknownPropertyProperty hash not found in registry.
TypeMismatchProperty value type doesn’t match expected type.
TimeoutOperation timed out.
SharedMemorySizeMismatchShared memory region size mismatch.
SharedMemoryPermissionPermission denied for shared memory operation.
SharedMemoryNotAvailableShared memory not available on this platform.
SharedMemoryCorruptedShared memory control block corrupted (magic/version mismatch).
SerializationFailedFailed to serialize message.
SchemaValidationFailedSchema field validation failed.
SchemaNotPublicSchema is not published for discovery.
SchemaNotFoundComponent schema not found in registry.
SchemaIncompatibleSchemas are structurally incompatible.
SchemaAlreadyExistsSchema already registered with different content.
ResourceLimitExceededResource limit exceeded (entities, properties, etc.).
RegistryFullRegistry has reached capacity limit.
NoneNo error.
InvalidParameterInvalid parameter provided.
InvalidMessageMalformed or invalid message.
HashCollisionProperty hash collision detected.
HandshakeFailedHandshake protocol failed.
EntityNotFoundEntity ID not found.
DeserializationFailedFailed to deserialize message.
DecompressionFailedFailed to decompress data.
ConnectionClosedConnection was closed.
CompressionFailedFailed to compress data.
AlreadyExistsEntity or property already exists.

Error codes for networking operations.

using EntropyEngine::Networking::Mat4 = glm::mat4;

4x4 matrix type (GLM, column-major)

using EntropyEngine::Networking::Mat3 = glm::mat3;

3x3 matrix type (GLM, column-major)

using EntropyEngine::Networking::EntityId = uint64_t;

Unique identifier for entities in the scene.

EntityId 0 is reserved to represent the root/no parent.

EnumeratorValueDescription
RemoteRemote network connection - uses WebRTC.
LocalLocal IPC - platform selects appropriate backend.

High-level connection type abstraction.

Represents platform-agnostic connection categories:

  • Local: In-process or local IPC (Unix socket, Named pipe, XPC)
  • Remote: Network connections (WebRTC, future: QUIC, WebTransport)
EnumeratorValueDescription
FailedConnection failed.
DisconnectingGraceful disconnect in progress.
DisconnectedInitial state or after disconnect.
ConnectingConnection in progress.
ConnectedFully connected and ready.

Connection state during lifecycle.

EnumeratorValueDescription
XPCForce XPC connection (macOS).
WebRTCForce WebRTC data channel (all platforms).
UnixSocketForce Unix domain socket (Linux/macOS).
SharedMemoryForce shared memory transport (all platforms, local only).
NamedPipeForce named pipe (Windows).
AutoAutomatic selection based on platform.

Explicit backend selection (advanced use).

Allows overriding platform auto-selection for specific backend choice. Use Auto for typical cases - platform picks the best backend.

using EntropyEngine::Networking::ComponentTypeHash = PropertyHash;

Type alias for component type identification.

ComponentTypeHash identifies a component type across applications. Computed from appId, componentName, schemaVersion, and structural hash.

Uses the same 128-bit hash structure as PropertyHash for consistency.

using EntropyEngine::Networking::CapnpPropertyValue = Protocol::PropertyValue;

Serialization helpers for ComponentSchema ↔ Cap’n Proto.

Provides functions to convert between C++ ComponentSchema structures and Cap’n Proto ComponentSchemaData messages.

using EntropyEngine::Networking::CapnpPropertyType = Protocol::PropertyType;
using EntropyEngine::Networking::AppId = std::string;

Application identifier.

Uniquely identifies an application in the Entropy ecosystem.

bool validatePropertyType(
const PropertyValue & value,
PropertyType expectedType
)

Validate that a property value matches the expected type.

Parameters:

  • value The property value variant
  • expectedType The expected type

Return: true if types match, false otherwise

PropertyValue val = 42;
if (validatePropertyType(val, PropertyType::Int32)) {
// Safe to use as int32
}
inline std::string toString(
const PropertyHash & hash
)

Convert PropertyHash to string for logging/diagnostics.

Parameters:

Return: String representation in format “high:low” (hex)

uint16_t toCapnpPropertyType(
PropertyType type
)

Convert C++ PropertyType to Cap’n Proto PropertyType enum.

Parameters:

Return: The corresponding Cap’n Proto PropertyType ordinal

Provides explicit, safe conversion between C++ and Cap’n Proto enum types rather than relying on implicit static_cast which assumes matching ordinals.

Note: Return type is uint16_t to avoid including capnp headers here. Cast result to ::PropertyType when using with Cap’n Proto builders.

void serializePropertyValue(
const PropertyValue & value,
CapnpPropertyValue::Builder builder
)

Serialize a PropertyValue to Cap’n Proto.

Parameters:

void serializePropertyDefinition(
const PropertyDefinition & definition,
Protocol::PropertyDefinitionData::Builder builder
)

Serialize a PropertyDefinition to Cap’n Proto.

Parameters:

  • definition The C++ PropertyDefinition to serialize
  • builder Cap’n Proto builder for PropertyDefinitionData
void serializeComponentSchema(
const ComponentSchema & schema,
Protocol::ComponentSchemaData::Builder builder
)

Serialize a ComponentSchema to Cap’n Proto.

Parameters:

  • schema The C++ ComponentSchema to serialize
  • builder Cap’n Proto builder for ComponentSchemaData
Result< std::vector< uint8_t > > serialize(
capnp::MessageBuilder & builder
)

Serialize a Cap’n Proto message to a byte vector.

Parameters:

  • builder The message builder containing the message

Return: Result containing byte vector or error

Converts a Cap’n Proto message builder to a flat byte array suitable for transmission over the network.

capnp::MallocMessageBuilder builder;
auto msg = builder.initRoot<entropy::Message>();
// ... populate message ...
auto result = serialize(builder);
if (result.success()) {
// Send result.value over network
}
static const char * rtcStateToString(
rtcState s
)
const char * propertyTypeToString(
PropertyType type
)

Convert PropertyType to human-readable string.

Parameters:

  • type The property type

Return: String representation

inline std::optional< PropertyType > mapTypeIdToPropertyType(
TypeID typeId
)

Runtime mapping from TypeID to PropertyType.

Parameters:

Return: PropertyType if mapped, nullopt otherwise

Dispatches TypeID comparison to known types. Required because TypeID is runtime hash-based (not compile-time constexpr).

Applications can extend this by adding their own type checks:

inline std::optional<PropertyType> mapTypeIdToPropertyType(TypeID typeId) {
// Check application types first
if (typeId == createTypeId<MyCustomType>()) return PropertyType::Int32;
// Fall back to EntropyNetworking defaults
return EntropyEngine::Networking::mapTypeIdToPropertyTypeDefault(typeId);
}
static bool iequal_prefix(
std::string_view a,
std::string_view b
)
PropertyType getPropertyType(
const PropertyValue & value
)

Get the PropertyType for a PropertyValue variant.

Parameters:

  • value The property value

Return: The PropertyType corresponding to the active variant

PropertyValue val = Vec3{1.0f, 2.0f, 3.0f};
PropertyType type = getPropertyType(val); // Returns PropertyType::Vec3
size_t getPropertySize(
PropertyType type
)

Get the minimum required size in bytes for a property type.

Parameters:

  • type The property type

Return: Size in bytes

Used for safety checks to ensure schema definitions provide enough space for the data type.

inline size_t getFieldSize(
TypeID typeId
)

Runtime field size lookup.

Parameters:

Return: Field size in bytes, or 0 if unknown

Workaround for FieldInfo not containing size information.

TODO: Submit PR to EntropyCore to add size_t to FieldInfo, eliminating need for this dispatch table.

Applications can extend this by adding their own type checks:

inline size_t getFieldSize(TypeID typeId) {
// Check application types first
if (typeId == createTypeId<MyCustomType>()) return sizeof(MyCustomType);
// Fall back to EntropyNetworking defaults
return EntropyEngine::Networking::getFieldSizeDefault(typeId);
}
inline uint64_t getCurrentTimestampMicros()

Get current timestamp in microseconds since epoch.

Return: Timestamp in microseconds since Unix epoch

Returns the current system time as microseconds since the Unix epoch. This is the standard timestamp format used throughout the networking protocol for message batches and timing information.

template <typename T >
Result< ComponentSchema > generateComponentSchema(
const std::string & appId,
uint32_t schemaVersion,
bool isPublic =true
)

Auto-generate ComponentSchema from TypeInfo reflection.

Parameters:

  • appId Application identifier (e.g., “CanvasEngine”)
  • schemaVersion Schema version number (increment on breaking changes)
  • isPublic Whether to publish for discovery (default: true)

Template Parameters:

  • T Component type with reflection (must have ENTROPY_REGISTER_TYPE)

Return: Result with ComponentSchema on success, error on failure

Eliminates manual PropertyDefinition boilerplate by extracting field information from ENTROPY_FIELD macro registrations.

Requirements:

Example:

struct Transform {
ENTROPY_REGISTER_TYPE(Transform);
ENTROPY_FIELD(Vec3, position) = {0.0f, 0.0f, 0.0f};
ENTROPY_FIELD(Quat, rotation) = {0.0f, 0.0f, 0.0f, 1.0f};
ENTROPY_FIELD(Vec3, scale) = {1.0f, 1.0f, 1.0f};
};
auto result = generateComponentSchema<Transform>("MyApp", 1, true);
if (result.success()) {
ComponentSchema schema = result.value;
// Register with ComponentSchemaRegistry...
}
PropertyType fromCapnpPropertyType(
uint16_t capnpType
)

Convert Cap’n Proto PropertyType to C++ PropertyType enum.

Parameters:

Return: The corresponding C++ PropertyType

Provides explicit, safe conversion between Cap’n Proto and C++ enum types.

inline const char * errorToString(
NetworkError error
)

Convert error code to human-readable string.

Parameters:

  • error The error code

Return: Description of the error

static void encodeU32BigEndian(
uint32_t value,
uint8_t * dest
)
static void encodeU32BigEndian(
uint32_t value,
uint8_t * dest
)
static std::vector< uint8_t > encodeSDPMessage(
const std::string & type,
const std::string & sdp
)
static std::vector< uint8_t > encodeSDPMessage(
const std::string & type,
const std::string & sdp
)
static std::vector< uint8_t > encodeICEMessage(
const std::string & candidate,
const std::string & mid
)
static std::vector< uint8_t > encodeICEMessage(
const std::string & candidate,
const std::string & mid
)
PropertyValue deserializePropertyValue(
CapnpPropertyValue::Reader reader
)

Deserialize a PropertyValue from Cap’n Proto.

Parameters:

Return: PropertyValue The deserialized C++ variant

PropertyDefinition deserializePropertyDefinition(
Protocol::PropertyDefinitionData::Reader reader
)

Deserialize a PropertyDefinition from Cap’n Proto.

Parameters:

  • reader Cap’n Proto reader for PropertyDefinitionData

Return: PropertyDefinition The deserialized C++ structure

Result< ComponentSchema > deserializeComponentSchema(
Protocol::ComponentSchemaData::Reader reader
)

Deserialize a ComponentSchema from Cap’n Proto.

Parameters:

  • reader Cap’n Proto reader for ComponentSchemaData

Return: Result The deserialized schema or error

Result< kj::Array< capnp::word > > deserialize(
const std::vector< uint8_t > & buffer
)

Deserialize a byte vector to a Cap’n Proto message.

Parameters:

  • buffer Serialized message bytes

Return: Result containing message reader or error

Parses a flat byte array into a Cap’n Proto message reader. The returned reader is valid for the lifetime of the input buffer.

std::vector<uint8_t> received = ...;
auto result = deserialize(received);
if (result.success()) {
auto reader = result.value;
// Access message via reader
}
Result< std::vector< uint8_t > > decompress(
const std::vector< uint8_t > & compressedData
)

Decompress zstd-compressed data.

Parameters:

  • compressedData Compressed data

Return: Result containing decompressed data or error

std::vector<uint8_t> compressed = ...;
auto result = decompress(compressed);
if (result.success()) {
auto original = result.value;
}
static uint32_t decodeU32BigEndian(
const uint8_t * src
)
static uint32_t decodeU32BigEndian(
const uint8_t * src
)
static std::optional< std::tuple< SignalingMessageType, std::string, std::string > > decodeSignalingMessage(
const std::vector< uint8_t > & data
)
static std::optional< std::tuple< SignalingMessageType, std::string, std::string > > decodeSignalingMessage(
const std::vector< uint8_t > & data
)
std::unique_ptr< SharedMemoryServer > createSharedMemoryServer(
ConnectionManager * connMgr,
const std::string & baseName
)

Creates a shared memory server.

Parameters:

  • connMgr Connection manager that will own accepted connections
  • baseName Base name for shared memory regions

Return: Unique pointer to SharedMemoryServer

std::unique_ptr< SharedMemoryServer > createSharedMemoryServer(
ConnectionManager * connMgr,
const std::string & baseName,
const SharedMemoryServer::Config & config
)

Creates a shared memory server with configuration.

Parameters:

  • connMgr Connection manager that will own accepted connections
  • baseName Base name for shared memory regions
  • config Server configuration

Return: Unique pointer to SharedMemoryServer

std::unique_ptr< RemoteServer > createRemoteServer(
ConnectionManager * connMgr,
uint16_t port =8080
)

Create a remote server with default configuration.

Parameters:

  • connMgr ConnectionManager to adopt new connections
  • port Port number to listen on (default 8080)

Return: Unique pointer to RemoteServer instance

Creates a RemoteServer using the default protocol (WebRTC). The server will listen on the specified port.

std::unique_ptr< RemoteServer > createRemoteServer(
ConnectionManager * connMgr,
const RemoteServerConfig & config
)

Create a remote server with custom configuration.

Parameters:

  • connMgr ConnectionManager to adopt new connections
  • config Complete server configuration

Return: Unique pointer to RemoteServer instance

Creates a RemoteServer with full control over configuration. Allows customization of TLS, polling intervals, protocol-specific settings, etc.

std::unique_ptr< LocalServer > createLocalServer(
ConnectionManager * connMgr,
const std::string & endpoint
)

Creates a platform-appropriate LocalServer instance.

Parameters:

  • connMgr Connection manager that will own accepted connections
  • endpoint Platform-specific endpoint (socket path or pipe name)

Return: Unique pointer to LocalServer implementation

std::unique_ptr< LocalServer > createLocalServer(
ConnectionManager * connMgr,
const std::string & endpoint,
const LocalServerConfig & config
)

Creates a LocalServer with configuration options.

static const char * connStateToString(
ConnectionState s
)
PropertyHash computePropertyHash(
uint64_t entityId,
ComponentTypeHash componentType,
const std::string & propertyName
)

Compute property hash from components.

Parameters:

  • entityId Entity instance identifier
  • componentType Component type hash from ComponentSchema
  • propertyName Property name within the component (e.g., “position”)

Return: 128-bit property hash

Computes a 128-bit hash using SHA-256. The hash is deterministic and provides per-instance property identification with ecosystem-scale collision resistance.

Hash construction: SHA-256(entityId || componentType || propertyName)

Result is truncated to 128 bits (high 128 bits of SHA-256 output).

The hash should be computed ONCE on property registration and stored/reused. Never recompute the hash - it is a stable identifier for the property instance.

// Compute hash once when property is created
auto typeHash = schema.typeHash;
auto hash = computePropertyHash(42, typeHash, "position");
// hash uniquely identifies property on entity 42 with this component type
// Different entity = different hash
auto hash2 = computePropertyHash(99, typeHash, "position");
// hash != hash2 (different entity IDs)
Result< std::vector< uint8_t > > compress(
const std::vector< uint8_t > & data,
int compressionLevel =3
)

Compress data using zstd.

Parameters:

  • data Uncompressed data
  • compressionLevel Compression level (1-22, default 3)

Return: Result containing compressed data or error

Compresses byte data for efficient transmission. Typically used for scene snapshots which can be large.

std::vector<uint8_t> largePayload = ...;
auto result = compress(largePayload);
if (result.success()) {
// Compressed size: result.value.size()
}

function NetworkSession::ComponentHandle::set< std::string >

Section titled “function NetworkSession::ComponentHandle::set< std::string >”
template NetworkSession::ComponentHandle & NetworkSession::ComponentHandle::set< std::string >(
const std::string & ,
const std::string &
)
static size_t DEFAULT_XPC_MAX_MESSAGE_SIZE = 64ull * 1024ull * 1024ull;
static int DEFAULT_WEBRTC_MAX_MESSAGE_SIZE = 256 * 1024;

variable DEFAULT_SHARED_MEMORY_REGION_SIZE

Section titled “variable DEFAULT_SHARED_MEMORY_REGION_SIZE”
static size_t DEFAULT_SHARED_MEMORY_REGION_SIZE = 4ull * 1024ull * 1024ull;
static size_t DEFAULT_MAX_MESSAGE_SIZE = 16ull * 1024ull * 1024ull;

Updated on 2026-01-26 at 17:14:35 -0500