How can I fix this porblem:
Channel with provided unique name already exists
Here is the code for creating channel:
tc.joinGeneralChannel = function () {
console.log('Attempting to join ' + $channelName + 'chat channel...');
if (!tc.generalChannel) {
console.log('Channel doesn\'t exists');
// If it doesn't exist, let's create it
tc.messagingClient.createChannel({
uniqueName: $channelName,
friendlyName: $channelName
}).then(function (channel) {
tc.generalChannel = channel;
tc.loadChannelList(tc.joinGeneralChannel);
});
} else {
setupChannel(tc.generalChannel);
}
};
The behavior is weird because the issue is not consistent.
Most of my code are the same with the tutorial twilio provided for laravel framework Twilio Docs
Is there a way to check if the unique name is already exists and then just join in there?