Code Monkey home page Code Monkey logo

node-ts3sdk-client's Introduction

TeamSpeak 3 SDK Client Addon for Node.js

Build Status

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.

const ts3client = require('node-ts3sdk-client');

ts3client.initClientLib(ts3client.LogTypes.CONSOLE, 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 ClientLib, use the on method:

ts3client.on('onConnectStatusChangeEvent', function(schID, status, errno)
{
  // your code
});

ts3client.on('onTalkStatusChangeEvent', function(schID, status, isWhisper, clientID)
{
  // your code
});

ts3client.on('onClientMoveEvent', function(schID, clientID, oldChannelID, newChannelID, visibility, moveMessage)
{
  // your code
});

Error Handling

When an error occurs, the addon will throw exceptions:

try
{
  ts3client.openCaptureDevice(schID, undefined, 'some_invalid_capture_device');
}
catch(err)
{
  var errno = ts3client.getLastError();

  console.log('ERROR ' + errno + ': ' + 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.