Transport Protocols
Asset Transport Protocols
Section titled “Asset Transport Protocols”The Asset System uses multiple transport strategies depending on asset size and connection type.
Small Assets
Section titled “Small Assets”For assets smaller than a configurable threshold (typically < 1MB), the data is sent directly in the AssetFetchResponse or AssetUploadResponse message on the Reliable channel.
Large Assets (Chunked Upload)
Section titled “Large Assets (Chunked Upload)”For larger files, the system uses a chunked transfer protocol to avoid blocking the main thread or saturating memory.
- Begin: Sender requests upload (
AssetUploadBegin), receiver allocates resources and returns anUploadId. - Chunk: Sender transmits chunks sequentially (
AssetUploadChunk). - Complete: Sender finalizes (
AssetUploadComplete), receiver assembles and verifies the SHA-256 hash.
sequenceDiagram
participant Sender
participant Receiver
Sender->>Receiver: AssetUploadBegin (Size, SHA)
Receiver-->>Sender: UploadId (1234)
loop Chunks
Sender->>Receiver: AssetUploadChunk (ID=1234, Seq=0, Data...)
Sender->>Receiver: AssetUploadChunk (ID=1234, Seq=1, Data...)
Receiver-->>Sender: AssetUploadChunkResponse (BytesReceived)
end
Sender->>Receiver: AssetUploadComplete (ID=1234)
Receiver-->>Sender: AssetUploadResponse (Success, AssetId)
WebRTC Data Channels
Section titled “WebRTC Data Channels”When using WebRTCConnection, assets can be transferred on a dedicated high-throughput data channel (separate from the reliable control channel) to prevent head-of-line blocking for latency-sensitive data.