Crates.io | stomp-rs |
lib.rs | stomp-rs |
version | 0.0.8 |
source | src |
created_at | 2021-07-07 20:44:53.950638 |
updated_at | 2022-03-25 11:20:48.342228 |
description | STOMP client |
homepage | |
repository | https://github.com/adhesivee/stomp-rs |
max_upload_size | |
id | 420045 |
size | 57,999 |
Creating new connection:
let client = Client::connect(
ClientBuilder::new("127.0.0.1:61613")
).await?;
Subscribing:
let (sender, mut receiver) = channel(16);
tokio::spawn(async move {
match receiver.recv().await {
Some(frame) => { /* process frame */}
None => { }
}
});
client.subscribe(
Subscribe::new_with_random_id("/topic/test"),
sender
).await
Sending:
client.send(
Send::new("/topic/test")
.body("test-message")
).await
Transaction:
let transaction = client.begin().await?;
transaction.send(
Send::new("/topic/test")
.body("test-message")
).await