Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Add documentation #18

Merged
merged 15 commits into from
Jul 10, 2021
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ description = "Pure rust nakama protocol implementation"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
marot marked this conversation as resolved.
Show resolved Hide resolved
test = []

[dependencies]
base64 = "0.13"
nanoserde = "0.1.26"
Expand All @@ -18,7 +21,9 @@ log = "0.4.14"
isahc = "1.4.0"
qws = { version = "0.7.9", features = ["ssl"] }

#[cfg(feature = "test")]
futures = "0.3.15"

[dev-dependencies]
simple_logger = "1.11.0"
cassette = "0.2.3"
futures = "0.3.15"
10 changes: 5 additions & 5 deletions examples/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn main() {
.unwrap();

let http_adapter = RestHttpAdapter::new("http://127.0.0.1", 7350);
let client = DefaultClient::new(http_adapter);
let client = DefaultClient::new(http_adapter, "defaultkey", "");
let adapter = WebSocketAdapter::new();
let adapter2 = WebSocketAdapter::new();
let web_socket = Arc::new(WebSocket::new(adapter));
Expand Down Expand Up @@ -116,10 +116,10 @@ fn main() {
let session2 = client
.authenticate_device("testdeviceid2", None, true, HashMap::new())
.await;
let mut session = session.unwrap();
let mut session2 = session2.unwrap();
web_socket.connect(&mut session, true, -1).await;
web_socket2.connect(&mut session2, true, -1).await;
let session = session.unwrap();
let session2 = session2.unwrap();
web_socket.connect(&session, true, -1).await;
web_socket2.connect(&session2, true, -1).await;
}
};

marot marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
10 changes: 5 additions & 5 deletions examples/async_single_threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn main() {
.unwrap();

let http_adapter = RestHttpAdapter::new("http://127.0.0.1", 7350);
let client = DefaultClient::new(http_adapter);
let client = DefaultClient::new(http_adapter, "defaultkey", "");
let adapter = WebSocketAdapter::new();
let adapter2 = WebSocketAdapter::new();
let web_socket = WebSocket::new(adapter);
Expand All @@ -72,10 +72,10 @@ fn main() {
let session2 = client
.authenticate_device("testdeviceid2", None, true, HashMap::new())
.await;
let mut session = session.unwrap();
let mut session2 = session2.unwrap();
web_socket.connect(&mut session, true, -1).await;
web_socket2.connect(&mut session2, true, -1).await;
let session = session.unwrap();
let session2 = session2.unwrap();
web_socket.connect(&session, true, -1).await;
web_socket2.connect(&session2, true, -1).await;
state.replace(Connected);
}
JoiningChat => {
Expand Down
4 changes: 2 additions & 2 deletions examples/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn main() {

let (tx_presence, rx_presence) = mpsc::channel::<StatusPresenceEvent>();

let mut session = client
let session = client
.authenticate_device("socket_example_id", None, true, HashMap::new())
.await
.expect("Failed to authenticate");
Expand All @@ -41,7 +41,7 @@ fn main() {
.expect("Failed to send status presence");
});

socket.connect(&mut session, true, -1).await;
socket.connect(&session, true, -1).await;

let status_presence = rx_presence
.recv()
Expand Down
Loading