From 1a10bc1a5f1ba0689187305587a28ecd8d61ce61 Mon Sep 17 00:00:00 2001 From: narawat Date: Wed, 25 Feb 2026 05:32:59 +0700 Subject: [PATCH] update --- docs/architecture.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 81ac9cd..f7ccb6a 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -445,7 +445,7 @@ end - Returns a dictionary (key-value map) containing all envelope fields: - `correlation_id`, `msg_id`, `timestamp`, `send_to`, `msg_purpose`, `sender_name`, `sender_id`, `receiver_name`, `receiver_id`, `reply_to`, `reply_to_msg_id`, `broker_url` - `metadata` - Message-level metadata dictionary - - `payloads` - List of dictionaries, each containing deserialized payload data + - `payloads` - List of tuples, each containing `(dataname, data, type)` with deserialized payload data **Process Flow:** 1. Parse the JSON envelope to extract all fields @@ -531,16 +531,16 @@ async function smartreceive(msg, options = {}) - Returns a Promise that resolves to an object containing all envelope fields: - `correlation_id`, `msg_id`, `timestamp`, `send_to`, `msg_purpose`, `sender_name`, `sender_id`, `receiver_name`, `receiver_id`, `reply_to`, `reply_to_msg_id`, `broker_url` - `metadata` - Message-level metadata dictionary - - `payloads` - List of dictionaries, each containing deserialized payload data with keys: `dataname`, `data`, `payload_type` + - `payloads` - List of tuples, each containing `(dataname, data, type)` with deserialized payload data **Process Flow:** 1. Parse the JSON envelope to extract all fields 2. Iterate through each payload in `payloads` array 3. For each payload: - - Determine transport type (`direct` or `link`) - - If `direct`: Base64 decode the data from the message - - If `link`: Fetch data from URL using exponential backoff (via `fileserver_download_handler`) - - Deserialize based on payload type (`dictionary`, `table`, `binary`, etc.) + - Determine transport type (`direct` or `link`) + - If `direct`: Base64 decode the data from the message + - If `link`: Fetch data from URL using exponential backoff (via `fileserver_download_handler`) + - Deserialize based on payload type (`dictionary`, `table`, `binary`, etc.) 4. Return envelope object with `payloads` field containing list of `(dataname, data, type)` tuples **Note:** The `fileserver_download_handler` receives `(url, max_retries, base_delay, max_delay, correlation_id)` and returns `ArrayBuffer` or `Uint8Array`. @@ -824,7 +824,7 @@ async def smartreceive( **Use Case:** Full-featured chat system supporting rich media. User can send text, small images directly, or upload large files that get uploaded to HTTP server and referenced via URLs. Claim-check pattern ensures reliable delivery tracking for all message components across all platforms. -**Implementation Note:** The `smartreceive` function iterates through all payloads in the envelope and processes each according to its transport type. See the standard API format in Section 1: `msgEnvelope_v1` supports `AbstractArray{msgPayload_v1}` for multiple payloads. +**Implementation Note:** The `smartreceive` function iterates through all payloads in the envelope and processes each according to its transport type. See the standard API format in Section 1: `msg_envelope_v1` supports `Vector{msg_payload_v1}` for multiple payloads. ## Performance Considerations