6 releases (breaking)
0.6.0 | Nov 15, 2022 |
---|---|
0.5.0 | Nov 15, 2022 |
0.4.0 | Nov 14, 2022 |
0.3.0 | Oct 28, 2022 |
0.1.0 | Oct 26, 2022 |
#298 in WebSocket
31 downloads per month
9KB
168 lines
Hathora Rust Client SDK
See this client in action here: https://github.com/hathora/topdown-shooter-bevy-client
Usage
let app_id = "...".to_string();
let client = HathoraClient::new(app_id, None);
let token = client
.login_anonymous()
.expect("Logging in should succeed.");
let roomId = client
.create(&token, vec![])
.expect("Creating a room should succeed");
let mut transport = client
.connect(&token, &roomId, HathoraTransportType::WebSocket)
.expect("Creating a websocket should succeed.");
let message = transport
.read_message()
.expect("Reading from websocket should succeed");
println!("Got message: {:?}", message);
transport
.write_message(b"{ message: \"Hello world\" }".to_vec())
.expect("Writing to socket should suceed");
Publishing
cargo publish
Dependencies
~6–19MB
~295K SLoC