node-ts3sdk-client
v3.0.4-14
Published
TeamSpeak 3 SDK Client addon for Node.js
Downloads
19
Readme
TeamSpeak 3 SDK Client Addon for Node.js
This native Node.js addon is a wrapper for the TeamSpeak 3 SDK and allows JavaScript implementations of third-party clients using the TeamSpeak 3 ClientLib.
Prerequisites
The following prerequisites are necessary prior to using the addon:
Installing
All dependencies can be installed via npm
:
npm install
This will also build build the module for your current platform. If you want to build the addon manually, issue the following commands in the root directory after cloning the repository:
$ node-gyp configure
$ node-gyp build
Testing
Included is a minimal console client to connect to a local TeamSpeak 3 SDK Server.
$ cd node-ts3sdk-client
$ node examples/client_minimal.js
Usage
Please refer to the official TeamSpeak 3 SDK documentation for a list of functions and events available.
Basics
After loading the addon, most TeamSpeak 3 ClientLib features are available in JavaScript. For the sake of convenience the ts3client_
prefix has been removed from function names and some arguments are optional.
var ts3client = require('ts3client.node');
ts3client.initClientLib(logLevel, logPath, soundBackendPath);
var schID = ts3client.spawnNewServerConnectionHandler();
var ident = ts3client.createIdentity();
ts3client.startConnection(schID, ident, '127.0.0.1', 9987, 'JohnDoe');
Callbacks
To register a callback to an event triggered by the TeamSpeak 3 CliebtLib, use the on
method:
ts3client.on('onClientMoveEvent', function(schID, clientID, oldChannelID, newChannelID, visibility, moveMessage)
{
// your code
});
Error Handling
When an error occurs, the addon will throw exceptions:
try
{
// your code
}
catch(err)
{
console.log(err.message);
}
Known Issues
I am aware that some features of the SDK are not implemented and I am working to update these. Please visit the project on GitHub to view outstanding issues.