I am writing bot application with node js and plugin 'node-teamspeak-api'.
I want to track connections of clients to some channel, and if client belongs to one of selected groups, to move it to another channel.
So I do
login id pw
use (number of server)
and then servernotifyregister looks like
Code:
function subscribeForChannelSwitch() {
return new Promise(function(resolve, reject) {
params = {
event : 'channel',
id : 0 // 0 id means that we listen on all channels
};
defines.tsClient.send('servernotifyregister', params, function(err, resp){
if (err) {
reject({
description : 'Error during \'servernotifyregister\' command.',
data : err
});
} else {
resolve({
description : 'Command \'servernotifyregister\' done for event \'channel\' with id ' + params.id + '.',
data : resp
});
}
});
});
}
and listener function is
Code:
defines.tsClient.on('notify', function(eventName, resp) {
includes.logger.info('Event notification on \'notify\':\n', eventName, resp, '\n');
processEvents(eventName, resp);
});
For a while (10-60 minutes) all looks oky, and events are received, but then, without any error message or anything, events are omitted, and not coming anymore.
Why? Is there any way to avoid this? Is the issue with the code or with plugin or with server settings? From putty I am getting notifications, but connection is closed after some.
Also would be good to see any documentation in english about events, because this very important article seems to be only in german.