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
|
||||
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!")
|
||||
```
|
||||
|
||||
@@ -183,7 +183,7 @@ print("Message sent!")
|
||||
const { smartsend } = require('./src/NATSBridge');
|
||||
|
||||
// Send a text message
|
||||
await smartsend("/chat/room1", [
|
||||
const { env, msg_json_str } = await smartsend("/chat/room1", [
|
||||
{ dataname: "message", data: "Hello World", type: "text" }
|
||||
], { natsUrl: "nats://localhost:4222" });
|
||||
|
||||
@@ -197,7 +197,7 @@ using NATSBridge
|
||||
|
||||
# Send a text message
|
||||
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!")
|
||||
```
|
||||
|
||||
@@ -323,7 +323,8 @@ env = smartsend(
|
||||
receiver_name="", # Receiver name (empty = broadcast)
|
||||
receiver_id="", # Receiver UUID (empty = broadcast)
|
||||
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: "",
|
||||
receiverId: "",
|
||||
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_id::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)
|
||||
# - env: msgEnvelope_v1 object with all envelope metadata and payloads
|
||||
|
||||
@@ -378,7 +378,7 @@ Each payload can have a different type, enabling mixed-content messages (e.g., c
|
||||
- `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
|
||||
- `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_id::String = ""` - UUID of the receiver (empty string means broadcast)
|
||||
- `reply_to::String = ""` - Topic to reply to (empty string if no reply expected)
|
||||
@@ -427,7 +427,7 @@ function smartsend(
|
||||
size_threshold::Int = DEFAULT_SIZE_THRESHOLD,
|
||||
correlation_id::Union{String, Nothing} = nothing,
|
||||
msg_purpose::String = "chat",
|
||||
sender_name::String = "default",
|
||||
sender_name::String = "NATSBridge",
|
||||
receiver_name::String = "",
|
||||
receiver_id::String = "",
|
||||
reply_to::String = "",
|
||||
|
||||
Reference in New Issue
Block a user