update readme
This commit is contained in:
16
README.md
16
README.md
@@ -109,9 +109,19 @@ msghandler enables seamless communication across multiple platforms through NATS
|
|||||||
```julia
|
```julia
|
||||||
using msghandler, NATS
|
using msghandler, NATS
|
||||||
|
|
||||||
data = [("test_message", "Hello World", "text")] # payloads to be send format is [(dataname, data, type), ...] tuples.
|
payload_1 = ("test_message", "Hello World", "text")
|
||||||
envelope, envelope_json_str = smartpack("test.topic", data; broker_url="nats.yiem.cc")
|
|
||||||
conn = NATS.connect(broker_url) # Create NATS connection
|
file_path_large_image = "./test/large_image.png"
|
||||||
|
file_data_large_image = read(file_path_large_image)
|
||||||
|
filename_large_image = basename(file_path_large_image)
|
||||||
|
payload_2 = (filename_large_image, file_data_large_image, "binary")
|
||||||
|
|
||||||
|
payloads = [payload_1, payload_2] # payloads to be send format is [(dataname, data, type), ...] tuples.
|
||||||
|
envelope, envelope_json_str = msghandler.smartpack("test.topic",
|
||||||
|
payloads;
|
||||||
|
broker_url="nats.yiem.cc",
|
||||||
|
fileserver_url="http://192.168.88.104:8080")
|
||||||
|
conn = NATS.connect("nats.yiem.cc") # Create NATS connection
|
||||||
NATS.publish(conn, "test.topic", envelope_json_str) # Publish message to NATS
|
NATS.publish(conn, "test.topic", envelope_json_str) # Publish message to NATS
|
||||||
NATS.drain(conn)
|
NATS.drain(conn)
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user