Normally a user only sees other clients who are in the same channel. Clients joining or leaving other channels or changing status are not displayed. To offer a way to get notifications about clients in other channels, a user can subscribe to other channels.
![]() | Note |
---|---|
A client is automatically subscribed to a joined channel. |
To subscribe to a channel call:
unsigned int ts3client_requestChannelSubscribe( | serverConnectionHandlerID, | |
channelID, | ||
returnCode) ; |
anyID serverConnectionHandlerID
;anyID channelID
;const char* returnCode
;To unsubscribe to a single channel call:
unsigned int ts3client_requestChannelUnsubscribe( | serverConnectionHandlerID, | |
channelID, | ||
returnCode) ; |
anyID serverConnectionHandlerID
;anyID channelID
;const char* returnCode
;To subscribe to all channels on the server call:
unsigned int ts3client_requestChannelSubscribeAll( | serverConnectionHandlerID, | |
returnCode) ; |
anyID serverConnectionHandlerID
;const char* returnCode
;To unsubscribe to all channels on the server call:
unsigned int ts3client_requestChannelUnsubscribeAll( | serverConnectionHandlerID, | |
returnCode) ; |
anyID serverConnectionHandlerID
;const char* returnCode
;To check if a channel is currently subscribed, check the flag CHANNEL_FLAG_ARE_SUBSCRIBED
with ts3client_getChannelVariableAsInt
:
int isSubscribed; if(ts3client_getChannelVariableAsInt(scHandlerID, channelID, CHANNEL_FLAG_ARE_SUBSCRIBED, &isSubscribed) != ERROR_ok) { /* Handle error */ }
The following event will be sent for each successfully subscribed channel:
void onChannelSubscribeEvent( | serverConnectionHandlerID, | |
channelID) ; |
anyID serverConnectionHandlerID
;anyID channelID
;Provided for convinience, to mark the end of mulitple calls to onChannelSubscribeEvent
when subscribing to several channels, this event is called:
void onChannelSubscribeFinishedEvent( | serverConnectionHandlerID) ; |
anyID serverConnectionHandlerID
;The following event will be sent for each successfully unsubscribed channel:
void onChannelUnsubscribeEvent( | serverConnectionHandlerID, | |
channelID) ; |
anyID serverConnectionHandlerID
;anyID channelID
;Similar like subscribing, this event is a convinience callback to mark the end of multiple calls to onChannelUnsubscribeEvent
:
void onChannelUnsubscribeFinishedEvent( | serverConnectionHandlerID) ; |
anyID serverConnectionHandlerID
;Once a channel has been subscribed or unsubscribed, the event onClientMoveSubscriptionEvent
is sent for each client in the subscribed channel. The event is not to be confused with onClientMoveEvent
, which is called for clients actively switching channels.
void onClientMoveSubscriptionEvent( | serverConnectionHandlerID, | |
clientID, | ||
oldChannelID, | ||
newChannelID, | ||
visibility) ; |
anyID serverConnectionHandlerID
;anyID clientID
;anyID oldChannelID
;anyID newChannelID
;int visibility
;Parameters
serverConnectionHandlerID
The server connection handler ID for the server where the action occured.
clientID
The client ID.
oldChannelID
ID of the subscribed channel where the client left visibility.
newChannelID
ID of the subscribed channel where the client entered visibility.
visibility
Defined in the enum Visibility
enum Visibility { ENTER_VISIBILITY = 0, RETAIN_VISIBILITY, LEAVE_VISIBILITY };
ENTER_VISIBILITY
Client entered visibility.
LEAVE_VISIBILITY
Client left visibility.
RETAIN_VISIBILITY
Does not occur with onClientMoveSubscriptionEvent.