Skip to content
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

Connect event doesn't fire on a pre-existing client process #63

Open
Metainy opened this issue Feb 19, 2022 · 2 comments
Open

Connect event doesn't fire on a pre-existing client process #63

Metainy opened this issue Feb 19, 2022 · 2 comments

Comments

@Metainy
Copy link

Metainy commented Feb 19, 2022

When using the LeagueClient class with the client already running, connect event doesn't fire.
With the app running I have to shutdown the client and reopen it for the event to fire.

I am just wondering if this is the default behavior or am I missing something here.

Package Version: v5.3.1
Environment: Vue CLI Plugin Electron Builder
Node: v16.14
Electron: v13

Note:
I am using the library as an external library in electron-builder config, not doing so will throw an error about riotgames.pem location. So by setting the package as a native dependency it solves the issue or I can copy the file to my project directory, but I don't think that's the issue here.

I am using the example code from the documentation

import { authenticate, LeagueClient } from "league-connect";

const credentials = await authenticate();
const client = new LeagueClient(credentials);

client.on("connect", (newCredentials) => {
  
  console.log("Client connected");
});

client.on('disconnect', () => {

});

client.start();
@junlarsen
Copy link
Owner

I suppose it'd be correct to say this is the default/expected behavior. Maybe it would be better to rename the event to 'reconnect' at next major version... It's basically an event for when the client is restarted (see source https://github.com/matsjla/league-connect/blob/master/src/client.ts#L73)

As of right now (see #55 for wanted feature) you have to have a set of credentials to construct the LeagueClient class, which already indicates you have received credentials from a running client.

@Metainy
Copy link
Author

Metainy commented Feb 19, 2022

Yea that make sense. I think #55 is exactly what I was looking for.
Will wait for the next release then. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants