Comments (10)
It also might be apparently disconnecting if idle for to long? Is this a server setting that times them out, or since I'm not doing a whoami loop to stay conected?
from teamspeak3queryapi.
The server disconnects an idle client. See: #7 (comment)
from teamspeak3queryapi.
Hmm, I do think it's a "bug" but, only because TeamSpeak themselves have made it one, I think the Connect or even Login function should accept an overload for Stay Alive, so it just sends a Who Am I every 5 seconds or so just to stay awake.
I'll hack that in my project, see if it fixes it, if it does I may submit a PR :)
from teamspeak3queryapi.
How about a separate class that takes a Client and sends heartbeats? Something kile this:
class HeartbeatSender {
HeartbeatSender(QueryClient client) { ... }
void StartHeartbeats() {}
void StopHeartbeats() {}
}
TeamSpeakClient c; // ...
var hb = new HeartbeatSender(c);
hb.StartHeartbeats();
Alternatively, we can build this right into the QueryClient. I don't know what the better approach would be.
Any pros and cons of both approaches?
from teamspeak3queryapi.
Hmm, the overload idea could work, you could hook it up to a stopwatch behind the scenes for every X seconds specified by the user with a default of 3 so it just sends a who am I?
That's at least what I am going to test with my project now, also any reason why TeamSpeakClient.Client.IsConnected would be false right after calling Connect? Do I need to really await everything in order for it to connect fully?
from teamspeak3queryapi.
Hmm, one caveat may be that if we do a keep alive style it may just get stuck waiting for that to finish then just keep stacking up other events which cause that to dead lock, or have I fallen off my rocker
Also, I'm now I'm not getting any events again for messages recieved, I have not been idle and IsConnected is true?
(I can't get code tags to work >:(, but this is the code I have to set every thing up and try register for events, I've also had the RegisterServer and RegisterTextServer notificatioons above the Subscription of events, ServerID is correct as the server has not changed and has worked previously with what I use.
KeepAlive = new System.Timers.Timer();
KeepAlive.Interval = 3000;
//KeepAlive.Elapsed += KeepAlive_Elapsed;
//Setup Instance, Connect and Login
Instance = new TeamSpeakClient(Host, Port);
Instance.Connect();
Instance.Login(User, Pass);
//Select Server & Set Nick
Instance.UseServer(ServerID);
Instance.ChangeNickName("Bitch");
//Setup Callbacks For My Events
Instance.Subscribe<ClientEnterView>(ClientEnter);
Instance.Subscribe<ClientLeftView>(ClientLeft);
Instance.Subscribe<TextMessage>(OnMessage);
//We Want Server & Server Text Events
Instance.RegisterServerNotification();
Instance.RegisterTextServerNotification();
//We're Ready!
Util.Log(Util.Source.TeamSpeak, "TeamSpeak Ready.");
Ready();
KeepAlive.Start();
from teamspeak3queryapi.
So I rewrote it all in async using this as a point of reference and events seem to be firing now, now sure if coincidence with the time taken to rewrite to lift some rate limit, but either way it works.
I'll report back if I see it get booted for being idle, if so I'll try the Timer elapsed way and let you know.
from teamspeak3queryapi.
Your code misses await keywords.
Having a Timer under the good would require a specific dependency that the library user might not have (and doesn't want to install, just for having a Timer).
I think the more appropriate way of implementing the heartbeat is adding a timeout for some task in the response queue.
from teamspeak3queryapi.
Yeah, I figured I could get away with not, like I said, I ended up writing using async and events now work (whoo!) but I still get timed out when not active.
I used the System.Timers.Timer() class (which I'm pretty sure is in .net core so we don't have to worry about people not having the dependency), but it seems that events don't fire with it running, I'm not sure if I'm whack, or I'm doing something wrong, but it appears stuff might get caught in the queue among other things if the timer has elapsed before it fires again
from teamspeak3queryapi.
I opened a new issue regarding the timeout feature: #65.
from teamspeak3queryapi.
Related Issues (20)
- No responses come through after lots of activity HOT 4
- TeamSpeak3QueryApi.pdb not loaded HOT 2
- Setting channel parent via channeledit does not work, consider removing it. HOT 1
- Not getting any response HOT 8
- SSH Support HOT 5
- Multiple channel notifications problem HOT 8
- Fatal error: Unsubscripe with callback won't work HOT 1
- Adding ssh as nuget package HOT 3
- SendAsync with Parameters and Options don't work HOT 1
- Feature Request: Automatic Keep-Alive HOT 3
- Get RequestedTalkPower of Client HOT 1
- Migrate to GH Actions HOT 1
- Adding Talkpower Serialization
- TeaSpeak connection was refused at .Connect(); HOT 1
- GetClients returns empty list in TextMessage notification
- Migrate to more recent .NET version HOT 10
- Unit tests for the query parser
- Improve API documentation HOT 2
- Client times out after 5 mins HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from teamspeak3queryapi.