Sending commands to TS3

To interact with TeamSpeak 3 in a manner that is not directly provided by the framework, plugins can send custom requests through the query connection.

IQueryConnection

The query connections sendRequest(IQueryRequest) method allows sending requests to the TeamSpeak server.
To construct a new request, plugins can use builder pattern provided by IQueryRequest.builder().

The request builder offers the ability to register a callback to consume the answer to that specific request. Otherwise, plugins can listen to IQueryRequest.IAnswer.

Many query commands can also be directly build by using convenience methods on the interfaces IServer, IChannel and IClient. These methods directly return the request.

๐Ÿ“˜

Requests are queued!

The query connection is limited to receive answers to one request at a time.
Once a request has been sent, other requests will be queued until the answer has fully been received.
The only exemption are notifications which bypass the whole request/answer life-cycle.

๐Ÿšง

Synchronisation and priority

Just as events, callbacks are called asynchronously but may not directly execute load-heavy code as they are served from a centralized thread pool.
If some callback consumer ends up blocking their thread, the thread pool may eventually be exhausted.

Request callbacks are always executed before the answer event is fired.