Open sergeynilov opened 3 years ago
From the start the original flow seemed complicated to me and I tried to simplify it, but lost some functionality.
I returned to the original and made it working mostly So I read list of all channels with Twilio API anset current Channel in method:
messagingClient.getPublicChannelDescriptors().then(function(channels) {
for (let i = 0; i < channels.items.length; i++) {
const channel = channels.items[i];
console.log('getVisibleChannels Channel: ' + channel.friendlyName);
}
// vm.tc.channelArray = vm.sortChannelsByName(channels.items);
vm.tc.channelArray = channels.items;
vm.tc.channelArray.forEach(vm.addChannel); // !!!
if (typeof handler === 'function') {
handler();
}
});
but I got error : Couldn't join channel public_oo_team_chat_5_2 because t: Member already exists In the method:
joinChannel(_channel) { // the member joins the channel (general or a personally created channel)
// debugger
let vm = this;
return _channel.join() // THis line raise the error
.then(function(joinedChannel) {
vm.updateChannelUI(_channel);
vm.tc.currentChannel = _channel;
vm.loadMessages();
return joinedChannel;
})
.catch(function(err) {
debugger
});
},
In the twilio console I found the user in members of Chat / AdsBackend8Chat / Channels / Members
Can you please give me a hint which checks have I to use to avoid this error ?
Thanks!
Hello Reading docs https://www.twilio.com/blog/implementing-programmable-chat-php-laravel-vue-js and this /example I encounetered error in next: I try to add in my Laravel 8 / jQuery 3.5.1 / vue 2.6 / Bootstrap 4.5 chat when logged user select another user I run axios request to check if channel was created priorly(or create a new channel). On client part
And on server part in app/Http/Controllers/Admin/TeamChatController.php:
and I when I get token from server I create client and try to conect to channel
and in joinChannel I got error :
on line:
I see in the browser's console :
https://prnt.sc/wekctp and https://prnt.sc/wekspu
Looks like there is an error in my flow, but it seems to me that I passwed valid object to line : _channel.join
Why error and how it can be fixed?
Thanks!