チャットルームが存在しないときにwebRTCアプリにチャットクライアントを追加しています。 1人のユーザがログインし、チャットルームが特定の名前で存在するかどうかを調べます。存在しない場合、ユーザーが作成します。 2番目のユーザーが同じチャットルーム名でログインして検索し、QB.chat.dialog.list({name: 'stringWithMyChatRoomName'})で検索しますが、最初のユーザーの後であっても結果に返されない部屋を作成しました。私は管理者の部屋を見ることができるので、彼らはDBで建設されていることを知っている。現在の結果が得られないコードは次のとおりです。Quickblox Javascript SDK + Angular + webRTC - 別のユーザーが作成した後に、名前によるチャットルームのフィルタが結果に表示されない
QB.createSession(function(err,result){
if (result) {
QB.login($scope.userParams, function(loginErr, loginUser){
if (loginUser) {
console.log('Logged in as:');
console.log(loginUser);
QB.users.update($scope.userParams.id, {tag_list: $scope.userParams.tag_list}, function(err, user){
if (user) {
console.log('updated room');
//console.log(user);
}else if (err) {
console.log('Didn\'t update room');
//console.log(err);
}
QB.chat.connect({
userId: $scope.userParams.id,
password: $scope.userParams.password,
login: $scope.userParams.full_name
}, function(err, result) {
if (result) {
console.log($scope.userParams.tag_list);
//$scope.userParams.user_tags = $scope.userParams.tag_list;
//$scope.updatePeerList();
var filters = {type: 2,name: $scope.userParams.tag_list};
//var filters = {name: $scope.userParams.tag_list}
QB.chat.dialog.list(filters, function(err, resDialogs) {
if (resDialogs) {
console.log(resDialogs);
if (resDialogs.total_entries === 0) {
QB.chat.dialog.create({
type: 2,
name: $scope.userParams.tag_list
}, function(err, createdDialog) {
if (createdDialog) {
console.log(createdDialog);
QB.chat.muc.join(createdDialog.xmpp_room_jid, function() {
});
} else {
console.log(err);
}
});
}else {
angular.forEach(resDialogs.items, function(item, i, arr) {
console.log('item found');
console.log(item);
$scope.chatSession = item;
// join room
if ($scope.chatSession.type !== 3) {
QB.chat.muc.join($scope.chatSession.xmpp_room_jid, function() {
});
}
//$scope.occupants = [];
$scope.chatSession.occupants_ids.map(function(userId) {
if ($scope.userParams.id !== userId && $scope.occupants.indexOf(userId) < 1) {
$scope.occupants.push(userId);
}
});
angular.forEach($scope.occupants, function (user_id) {
if (user_id !== $scope.userParams.id) {
var msg = {
type: 'chat',
extension: {
notification_type: 1,
_id: $scope.chatSession.xmpp_room_jid,
name: $scope.userParams.full_name,
occupant: $scope.userParams.id
}
};
console.log(user_id);
QB.chat.send(user_id, msg);
}
});
});
console.log('scope apply occupants and chatSession');
$scope.$apply();
}
} else {
console.log('error with chat.dialog.list');
console.log(err);
}
});
} else {
console.log('chat.connect failed');
console.log(res);
}
});
});
}else {
console.log('log in error');
console.log(loginErr);
}
});
}else if (err) {
console.log('Error creating session');
console.log(err);
}
});
今私はすべてのグループ期間を検索しようとしましたが、0も返します。私はパブリックグループを作成するためにそれを変更しようとしましたが、何らかの理由でQBが部屋のユーザーのIDを表示しないため、ユーザーIDを持たないユーザーにメッセージを送信する方法がありません。
希望の効果を得る方法を教えてください。ありがとうございました。