-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Can you help me detecting when connecting to lobby ? #10
Comments
You should subscribe to LCU websocket to detect it. Here is an API to get the current phase. GET /lol-gameflow/v1/gameflow-phase The "ReadyCheck" result means ready to accept matchmaking found. |
I managed to send the GET request and it worked. So I think I should send a GET Request every 1 second to detect whenever I get into a champ select. Lastly I would need to know when someone send a message, if you have any idea |
This will solve your problem. In my comment above, you no need to call this API every seconds. ws.onmessage = async message => {
const data = JSON.parse(message.data)
console.log(data)
const api = /* extract the data to get API */
if (api === '/lol-gameflow/v1/gameflow-phase') {
// todo
}
} |
Oh, there's been a misunderstanding. When I said I sent a GET request and that it worked, I meant that I tried :
The issue I had with the subscribe() function is that it wouldn't send back anything else than the initial response : After this when I connected to a champ-select, or when someone sent a message in champ-select, it wouldn't tell me(I put a console.log() inside it printing "yay", as you see it gets triggered once but then it doesn't anymroe) Here is the code I pasted in the console to clear any misunderstanding :
|
I'm sorry, the event name -ws.onopen = () => ws.send(JSON.stringify([5, 'JsonApiEvent']))
+ws.onopen = () => ws.send(JSON.stringify([5, 'OnJsonApiEvent'])) |
Yay, it works <3 Thank you man |
Hey,
First of all thank you for this tool it's very useful.
I want to detect when I'm connecting to the chat in champ-select. I don't have much knowledge, but I found a few things on the internet and they work for everything but what I want.
I am trying to use MutationObserver API to detect when an element of class
chat-message
is created, so upon arriving in the champ-select I run this in the console :And then I send a message to see if it caught it, and it didn't.
I tried using the MutationObserver in league-loader for capturing other things and it did work, here specifically it won't.
I hoped you could help me, not necessarily using MutationObserver, but anything that can detect when I'm connected to the chat in champ-select will do.
The code example is just one of about ten other ways I tried to do it but that didn't work, I'm running out of ideas. I even tried using ChatGPT to generate code, and it did, and again it worked for everything but for the chat messages :(
Thank you !
The text was updated successfully, but these errors were encountered: