update
This commit is contained in:
15
README.md
15
README.md
@@ -173,7 +173,7 @@ from nats_bridge import smartsend
|
|||||||
|
|
||||||
# Send a text message
|
# Send a text message
|
||||||
data = [("message", "Hello World", "text")]
|
data = [("message", "Hello World", "text")]
|
||||||
env = smartsend("/chat/room1", data, nats_url="nats://localhost:4222")
|
env, msg_json_str = smartsend("/chat/room1", data, nats_url="nats://localhost:4222")
|
||||||
print("Message sent!")
|
print("Message sent!")
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ print("Message sent!")
|
|||||||
const { smartsend } = require('./src/NATSBridge');
|
const { smartsend } = require('./src/NATSBridge');
|
||||||
|
|
||||||
// Send a text message
|
// Send a text message
|
||||||
await smartsend("/chat/room1", [
|
const { env, msg_json_str } = await smartsend("/chat/room1", [
|
||||||
{ dataname: "message", data: "Hello World", type: "text" }
|
{ dataname: "message", data: "Hello World", type: "text" }
|
||||||
], { natsUrl: "nats://localhost:4222" });
|
], { natsUrl: "nats://localhost:4222" });
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ using NATSBridge
|
|||||||
|
|
||||||
# Send a text message
|
# Send a text message
|
||||||
data = [("message", "Hello World", "text")]
|
data = [("message", "Hello World", "text")]
|
||||||
env = NATSBridge.smartsend("/chat/room1", data, nats_url="nats://localhost:4222")
|
env, msg_json_str = NATSBridge.smartsend("/chat/room1", data, nats_url="nats://localhost:4222")
|
||||||
println("Message sent!")
|
println("Message sent!")
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -323,7 +323,8 @@ env = smartsend(
|
|||||||
receiver_name="", # Receiver name (empty = broadcast)
|
receiver_name="", # Receiver name (empty = broadcast)
|
||||||
receiver_id="", # Receiver UUID (empty = broadcast)
|
receiver_id="", # Receiver UUID (empty = broadcast)
|
||||||
reply_to="", # Reply topic
|
reply_to="", # Reply topic
|
||||||
reply_to_msg_id="" # Reply message ID
|
reply_to_msg_id="", # Reply message ID
|
||||||
|
is_publish=True # Whether to automatically publish to NATS
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -346,7 +347,8 @@ const env = await smartsend(
|
|||||||
receiverName: "",
|
receiverName: "",
|
||||||
receiverId: "",
|
receiverId: "",
|
||||||
replyTo: "",
|
replyTo: "",
|
||||||
replyToMsgId: ""
|
replyToMsgId: "",
|
||||||
|
isPublish: true // Whether to automatically publish to NATS
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
@@ -369,7 +371,8 @@ env, msg_json_str = NATSBridge.smartsend(
|
|||||||
receiver_name::String = "",
|
receiver_name::String = "",
|
||||||
receiver_id::String = "",
|
receiver_id::String = "",
|
||||||
reply_to::String = "",
|
reply_to::String = "",
|
||||||
reply_to_msg_id::String = ""
|
reply_to_msg_id::String = "",
|
||||||
|
is_publish::Bool = true # Whether to automatically publish to NATS
|
||||||
)
|
)
|
||||||
# Returns: (msgEnvelope_v1, JSON string)
|
# Returns: (msgEnvelope_v1, JSON string)
|
||||||
# - env: msgEnvelope_v1 object with all envelope metadata and payloads
|
# - env: msgEnvelope_v1 object with all envelope metadata and payloads
|
||||||
|
|||||||
@@ -377,9 +377,9 @@ Each payload can have a different type, enabling mixed-content messages (e.g., c
|
|||||||
- `fileserverUploadHandler::Function = plik_oneshot_upload` - Function to handle fileserver uploads (must return Dict with "status", "uploadid", "fileid", "url" keys)
|
- `fileserverUploadHandler::Function = plik_oneshot_upload` - Function to handle fileserver uploads (must return Dict with "status", "uploadid", "fileid", "url" keys)
|
||||||
- `size_threshold::Int = DEFAULT_SIZE_THRESHOLD` - Threshold in bytes separating direct vs link transport
|
- `size_threshold::Int = DEFAULT_SIZE_THRESHOLD` - Threshold in bytes separating direct vs link transport
|
||||||
- `correlation_id::Union{String, Nothing} = nothing` - Optional correlation ID for tracing; if `nothing`, a UUID is generated
|
- `correlation_id::Union{String, Nothing} = nothing` - Optional correlation ID for tracing; if `nothing`, a UUID is generated
|
||||||
- `msg_purpose::String = "chat"` - Purpose of the message: "ACK", "NACK", "updateStatus", "shutdown", "chat", etc.
|
- `msg_purpose::String = "chat"` - Purpose of the message: "ACK", "NACK", "updateStatus", "shutdown", "chat", etc.
|
||||||
- `sender_name::String = "default"` - Name of the sender
|
- `sender_name::String = "NATSBridge"` - Name of the sender
|
||||||
- `receiver_name::String = ""` - Name of the receiver (empty string means broadcast)
|
- `receiver_name::String = ""` - Name of the receiver (empty string means broadcast)
|
||||||
- `receiver_id::String = ""` - UUID of the receiver (empty string means broadcast)
|
- `receiver_id::String = ""` - UUID of the receiver (empty string means broadcast)
|
||||||
- `reply_to::String = ""` - Topic to reply to (empty string if no reply expected)
|
- `reply_to::String = ""` - Topic to reply to (empty string if no reply expected)
|
||||||
- `reply_to_msg_id::String = ""` - Message ID this message is replying to
|
- `reply_to_msg_id::String = ""` - Message ID this message is replying to
|
||||||
@@ -427,7 +427,7 @@ function smartsend(
|
|||||||
size_threshold::Int = DEFAULT_SIZE_THRESHOLD,
|
size_threshold::Int = DEFAULT_SIZE_THRESHOLD,
|
||||||
correlation_id::Union{String, Nothing} = nothing,
|
correlation_id::Union{String, Nothing} = nothing,
|
||||||
msg_purpose::String = "chat",
|
msg_purpose::String = "chat",
|
||||||
sender_name::String = "default",
|
sender_name::String = "NATSBridge",
|
||||||
receiver_name::String = "",
|
receiver_name::String = "",
|
||||||
receiver_id::String = "",
|
receiver_id::String = "",
|
||||||
reply_to::String = "",
|
reply_to::String = "",
|
||||||
|
|||||||
Reference in New Issue
Block a user