Events

The server lib will notify the server application about certain actions by sending events as callbacks. Callback function pointers needs to be initialized in ts3server_initServerLib.

[Note]Note

Your callback implementations should exit quickly to avoid blocking the server. If you require to do lengthly operations, consider using a new thread to let the callback itself finish as soon as possible.

All strings are UTF-8 encoded.

A client has connected:

void onClientConnected(serverID,  
 clientID,  
 channelID,  
 removeClientError); 
uint64 serverID;
anyID clientID;
uint64 channelID;
unsigned int* removeClientError;
 

Parameters


A client has disconnected:

void onClientDisconnected(serverID,  
 clientID,  
 channelID); 
uint64 serverID;
anyID clientID;
uint64 channelID;
 

Parameters


A client has moved into another channel:

void onClientMoved(serverID,  
 clientID,  
 oldChannelID,  
 newChannelID); 
uint64 serverID;
anyID clientID;
uint64 oldChannelID;
uint64 newChannelID;
 

Parameters


A channel has been created:

void onChannelCreated(serverID,  
 invokerClientID,  
 channelID); 
uint64 serverID;
anyID invokerClientID;
uint64 channelID;
 

Parameters


A channel has been edited:

void onChannelEdited(serverID,  
 invokerClientID,  
 channelID); 
uint64 serverID;
anyID invokerClientID;
uint64 channelID;
 

Parameters


A channel has been deleted:

void onChannelDeleted(serverID,  
 invokerClientID,  
 channelID); 
uint64 serverID;
anyID invokerClientID;
uint64 channelID;
 

Parameters


Text messages can be received on the server side. Only server and channel chats trigger this event, client-to-client messages are not caught for privacy reasons.

Server chat messages can be intercepted with:

void onServerTextMessageEvent(serverID,  
 invokerClientID,  
 textMessage); 
uint64 serverID;
anyID invokerClientID;
const char* textMessage;
 

Parameters

Channel chat messages can be intercepted with:

void onChannelTextMessageEvent(serverID,  
 invokerClientID,  
 targetChannelID,  
 textMessage); 
uint64 serverID;
anyID invokerClientID;
uint64 targetChannelID;
const char* textMessage;
 

Parameters


If user-defined logging was enabled when initialzing the Server Lib by passing LogType_USERLOGGING to the usedLogTypes parameter of ts3server_initServerLib, log messages will be sent to the following callback, which allows user customizable logging and handling or critical errors:

void onUserLoggingMessageEvent(logMessage,  
 logLevel,  
 logChannel,  
 logID,  
 logTime,  
 completeLogString); 
const char* logMessage;
int logLevel;
const char* logChannel;
uint64 logID;
const char* logTime;
const char* completeLogString;
 

Parameters


A client connected to this server starts or stops talking:

void onClientStartTalkingEvent(serverID,  
 clientID); 
uint64 serverID;
anyID clientID;
 

void onClientStopTalkingEvent(serverID,  
 clientID); 
uint64 serverID;
anyID clientID;
 

Parameters


If required, the raw voice data can be caught by the server to implement server-side voice recording. Whenever a client is sending voice data, the following function is called:

void onVoiceDataEvent(serverID,  
 clientID,  
 voiceData,  
 voiceDataSize,  
 frequency); 
uint64 serverID;
anyID clientID;
unsigned char* voiceData;
unsigned int voiceDataSize;
unsigned int frequency;
 

Parameters

[Note]Note

This event is always fired, even if the client is the only user in a channel. So clients “talking to themselves” will also be recorded.

If server-side recording is not required, don't implement this callback.


The following event is called when a license error occurs, like for example missing license file, expired license, starting too many virtual servers etc. Instead of shutting down the whole process by throwing a critical error in the Server Lib, this callback allows you to handle the issue gracefully and keep your application running.

void onAccountingErrorEvent(serverID,  
 errorCode); 
uint64 serverID;
unsigned int errorCode;
 

Parameters