-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create sub library for the LCU #24
Comments
Are you mainly interested in making an user interactive app that hooks into LCU, or just want to collect data? |
Mainly in a User interactive app. Although a bit of data collection to support it wouldn't hurt the app. |
Which endpoints are you planning on using? We should pick some to support initially and add more as needed Endpoints to be included (preliminary): Control
Summoner
Champion
Ranked
Chat
|
Specifically:
|
Alright, I have an initial version that you can test. https://www.nuget.org/packages/Camille.Lcu/ Currently the setup is pretty hidden from the user, just calling Very minimal example usage: https://github.com/MingweiSamuel/Camille/blob/6358c6d/Camille.Lcu.Test/UnitTest1.cs#L27-L39 |
I will test this somewhere this week. And try to build a nice application that we can use as an example/showcase of the LCU |
It seems like the LCU also has support for WebSockets. Which might be a good idea to also implement. André from the API discord linked: https://gist.github.com/Pupix/eb662b1b784bb704a1390643738a8c15 to me as a showcase of how to use the WebSocket approach |
Will put that down as a TODO, but unfortunately don't have time to work on it this week |
Looks like it will be easiest to just support .net core & standard 2.1+ due to the custom cert used by the client
Also took a look at https://github.com/sta/websocket-sharp as an alternative but looking at the commit history, it's like twilight zone, no idea whats going on with that package (and no nuget updates in 3 years). |
Enabling the Cert globally sounds risky in terms of security. My preferred option here would be to bump the version of the LCU library. Then we don't have to rely on updates of other libraries, and we keep it completely in the framework. |
Any opinions on what the interface should look like? My philosophy has been for Camille to do as little as possible to get a one-to-one mapping between the methods available and the api methods. In this case a minimum WAMP would essentially be: event OnConnected
event OnDisconnected
subscribe(string/enum eventtype, event handler)
publish(string/enum eventtype, obj message) // not really needed, probably (list of events here: https://github.com/MingweiSamuel/lcu-schema/blob/master/help.json#L2-L1433) But it would be nice to have other features. Automatic reconnects, maybe awaitable events. Not sure what would be useful and how it would interact with the REST portion of the LCU (if at all) |
I generally add everything that is public facing to the interface, if an external library/project may have need of it. Since otherwise you will constantly be casting the interface back to the impl or just use the impl flatout. |
Ah, I meant "interface" in the more general way of how the API would look like on the outside. Anyway, I have a first-pass version: https://github.com/MingweiSamuel/Camille/blob/0b45aca/Camille.Lcu.Test/UnitTest1.cs#L18-L48 Essentially there is a new Currently the subscribe handler just gets a jtoken object, not an actual plain class. But the LCU does actually provide that info so I will add it eventually. There's not a way to unsubscribe right now. It's a bit clunky but works as a first-pass. |
Expanding on the first-pass version, what about Using BTW, I've ported a modified version of lcu-schema/update.ps1 to GitHub Actions so that I can continuously test my LCU integrated app. |
The mapping seems to be I've yet to check the other events. I've opted for using private event LeagueClientEventHandler<LolChampSelectChampSelectSession> _sessionChanged;
public event LeagueClientEventHandler<LolChampSelectChampSelectSession> SessionChanged
{
add
{
if (_sessionChanged == null)
EventRouter.Subscribe("OnJsonApiEvent_lol-champ-select_v1_session", (LolChampSelectChampSelectSession args) => _sessionChanged?.Invoke(this, args));
_sessionChanged += value;
}
remove
{
_sessionChanged -= value;
if (_sessionChanged == null)
EventRouter.Unsubscribe("OnJsonApiEvent_lol-champ-select_v1_session");
}
} Note: the code excerpt doesn't have created/updated/deleted implemented. My implementation of events is now live with version 12.4.1.336 if you want to get a feel for it (e.g. |
Suggestion to create
Camille.LCU
which will enable people to interface with the league client from C#The text was updated successfully, but these errors were encountered: