Twilio IP消息中的通信是基于信道的。我掌握了身份验证,我通过公共渠道实现了通信,现在我想实现两个用户之间的私有通信,我应该如何处理呢?我认为我必须建立一个私人频道
messagingClient.createChannel({
uniqueName: 'secret',
friendlyName: 'Private Chat Channel',
isPrivate: true
}).then(function(channel) {
console.log('Created private channel:');
console.log(channel);
});私有通道意味着它只是对其他人隐藏,但如何强制限制用户加入该通道,使其更加安全?
发布于 2016-01-09 09:45:46
两位开发人员在这里传道。
首先,根据最新的文件,如果您希望将通道设置为私有,则需要将其Type设置为private。
messagingClient.createChannel({
uniqueName: 'secret',
friendlyName: 'Private Chat Channel',
type: 'private'
}).then(function(channel) {
console.log('Created private channel:');
console.log(channel);
});然后,当您将频道设置为私有时,其他用户只能通过邀请加入该频道。这是一个在API中控制的限制,所以只要您已经将通道设置为私有,就不需要担心它的其余部分。
如果这有帮助的话请告诉我。
发布于 2022-04-17 21:52:25
确保您更改了isPrivate: true
转到type: 'private'
此外,您还可以具有身份验证器函数,例如,if (user.username === 'donald'){ } etc.。
https://stackoverflow.com/questions/34621255
复制相似问题