-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feature: Event on connection lost #45
Comments
why not make a loop that checks if the bool function IsConnected() of TeamSpeakClient.Client is false? |
I tried that at first, didn't work. |
Hey @dedmen , there is a much smarter solution by just added the event. You just need to add your QueryClient.cs like this. Adding the Eventhandler
Adding the firing methodAfter that you need to create the virtual method the fire the event. I´ve added this code before the constructors but it doesen´t matter where you add it.
Firing the method if the connection is lostNow you just need to fire the method if the client lost the connection. That on line 407. There you just type
That´s it. Now you can easy check for a lost connection without traffic waste 👍 . Now to be fair here is my example how I check the connection. Example
I hope you can work with this :) |
Yeah thats exactly what I was requesting. Why not make a pull request and get it added to the library? |
I will make a pull request if I am finished with fixing all problems. There are also a problem if the user is banned. There will be no QueryExecaption casted. Currently in my project I added the whole source and not the package to develop live with the source. I just read this issue and create you fast fix 👍 |
I have the issue that my service monitoring my TS server is apparently loosing Query connection after hours/days.
Would be good to have a event to notify me of that, such that I can trigger a reconnect.
I think firing a event from here would work?:
https://github.com/nikeee/TeamSpeak3QueryAPI/blob/master/src/TeamSpeak3QueryApi/QueryClient.cs#L394
The text was updated successfully, but these errors were encountered: