-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is related to #116. Currently it's only enables user to set custom peer-identity if needed and passes options all around. Later we can add other options to this struct. Some minor changes to ReadyCommand properties were required cause ZMQ_IDENTITY could be any byte vec and not guaranteed to be valid String
- Loading branch information
1 parent
511240e
commit 31e5d3d
Showing
13 changed files
with
140 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
mod async_helpers; | ||
|
||
use std::convert::TryFrom; | ||
use std::error::Error; | ||
use zeromq::util::PeerIdentity; | ||
use zeromq::{Socket, SocketOptions, SocketRecv, SocketSend}; | ||
|
||
#[async_helpers::main] | ||
async fn main() -> Result<(), Box<dyn Error>> { | ||
let mut options = SocketOptions::default(); | ||
options.peer_identity(PeerIdentity::try_from(Vec::from("SomeCustomId")).unwrap()); | ||
|
||
let mut socket = zeromq::ReqSocket::with_options(options); | ||
socket | ||
.connect("tcp://127.0.0.1:5555") | ||
.await | ||
.expect("Failed to connect"); | ||
println!("Connected to server"); | ||
|
||
for _ in 0..10u64 { | ||
socket.send("Hello".into()).await?; | ||
let repl = socket.recv().await?; | ||
dbg!(repl); | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.