fileHeader (12)
The fileHeader message initiates a file transfer by sending metadata about the file to the recipient. This allows the recipient's client to display a prompt to the user, asking them if they wish to accept or decline the incoming file.
Core Data Types
string: A standard UTF-8 encoded string, prefixed with its length.IxiVarUInt: See IxiVarInt Encoding.
Payload Structure
The payload is a serialized object containing all the necessary information for the recipient to identify the file transfer.
| Field | Data Type | Min | Max | Description |
|---|---|---|---|---|
uid | string | * | * | A unique identifier for this specific file transfer session. |
fileName | string | 1 | * | The original name of the file, including its extension. |
fileSize | IxiVarUInt | 1 | * | The total size of the file in bytes. |
Behavioral Notes
- Sending: A user initiates a file transfer by selecting a file. Their client generates a unique
uid, constructs thefileHeaderpayload with the file's metadata, and sends it to the intended recipient. - Receiving: Upon receiving a
fileHeader, the recipient's client should display a notification to the user showing thefileNameandfileSizeand asking for confirmation to download. The client stores theuidto manage the transfer session. - User Action: If the user accepts the transfer, their client responds with an
acceptFilemessage, including theuidfrom this header. If they decline, no response is sent.