#lol #api-client #lcu #sockets

league-client

Connect to your league of legends client

4 releases

0.2.1 Mar 13, 2024
0.2.0 Mar 13, 2024
0.1.1 Mar 12, 2024
0.1.0 Mar 10, 2024

#88 in WebSocket

Download history 395/week @ 2024-03-10 18/week @ 2024-03-17 29/week @ 2024-03-31

442 downloads per month

MIT license

19KB
381 lines

league-client

LCU - The League Client Rust Wrapper

Speaker allows you to communicate with the socket.

Types

I'm very lazy and I'm not going to hand type these but I do have an idea in the future to generate all these.

For now you can just use serde_json::from_value to do your thing. This will allow to make only the ones you need going forward.

Example

Rather run it instead? Just log in and run the example to see it in action.

let builder = client::Client::builder().unwrap();
let lc = builder.insecure(true).build().unwrap();
let connected = lc.connect_to_socket().await.unwrap();

let speaker = league_client::subscribe(connected).await;

// You must send this to get events.
let msg = (5, "OnJsonApiEvent");
let msg = serde_json::to_string(&msg).unwrap();
speaker.send(msg).await.expect("should have sent a message");

while let Ok(msg) = speaker.reader.recv_async().await {
    println!("{msg:?}");
}

Dependencies

~10–27MB
~408K SLoC