Hi everyone, on the guide I read that it is possible to send signals to a single user instead of using broadcast messages.
I tried to implement the solution, but all users continue to receive the signal even though I have set the “to: [” connectionID “]” as described in the guide.
I leave my code below, can someone tell me what am I wrong?
myFunction()
{
if(this.participantsNameList.length > 0)
{
var sReceivers = '';
// Ciclo i partecipanti per ottenre il numero di admin totale.
for(var i = 0; i < this.participantsNameList.length; i++)
{
if(this.participantsNameList[i].nickname.includes('_admin'))
{
if(sReceivers != '')
{
sReceivers += ',';
}
sReceivers += this.participantsNameList[i].connectionId;
}
}
if(sReceivers != '')
{
const dData =
{
message: 'test-message'
};
this.mySignalFunction(dData, 'dd-command-test-message', JSON.stringify(sReceivers));
}
}
}
mySignalFunction(dUserData: any, sSignalType: string, sReceivers: any = '')
{
const sessionAvailable = this.openViduWebRTCService.getSessionOfUserConnected();
sessionAvailable.signal
({
to: [sReceivers],
data: JSON.stringify(dUserData),
type: sSignalType
});
}
Many thanks in advance.