Multivit4min / TS3-NodeJS-Library

TeamSpeak 3 Server Query Library supports SSH and RAW Query
https://multivit4min.github.io/TS3-NodeJS-Library/
MIT License
149 stars 17 forks source link

TeamSpeak Server prematurely closed the connection #178

Closed ConductorWon closed 2 years ago

ConductorWon commented 2 years ago

Describe the bug I'm not sure if this is a bug or more of I am doing something wrong. However, I keep getting the above-noted error. I have a node-cron job set up to run the code with the TeamSpeak pull in it every 30 minutes through a discord bot. After its 6th run, it stopped connecting and continuously produced this error. Restarting my bot corrects the issue temporarily.

To Reproduce I have the appropriate requires at the top of the file as well. This is in my ready event. Code to reproduce the behavior

Expected behavior Consistent connection to the TS server

Versions used

Additional context Full error: Error: TeamSpeak Server prematurely closed the connection 1|FWRP_Bot_Test | at TeamSpeak.closeCallback (/root/FWRP_Bot_Test/node_modules/ts3-nodejs-library/lib/TeamSpeak.js:130:24) 1|FWRP_Bot_Test | at Object.onceWrapper (node:events:514:26) 1|FWRP_Bot_Test | at TeamSpeak.emit (node:events:394:28) 1|FWRP_Bot_Test | at TeamSpeakQuery. (/root/FWRP_Bot_Test/node_modules/ts3-nodejs-library/lib/TeamSpeak.js:58:45)

Again, not sure if I am doing something wrong on my end or if its an actual issue, just looking for some insight.

Multivit4min commented 2 years ago

Do you close the connection after pulling the data? TeamSpeak has a limit on how many query connections it allows per IP.

ConductorWon commented 2 years ago

I do not, and I did not know that. I didn't see anything in your documentation about closing the connection. How would I go about doing that? Thanks for the quick reply, love the package

Multivit4min commented 2 years ago

https://multivit4min.github.io/TS3-NodeJS-Library/classes/TeamSpeak.html#quit

await teamspeak.quit()
ConductorWon commented 2 years ago

Awesome, thank you