Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No response from QB.chat.muc.join(dialogJid) method #102

Closed
123AndGo opened this issue Jan 22, 2016 · 16 comments
Closed

No response from QB.chat.muc.join(dialogJid) method #102

123AndGo opened this issue Jan 22, 2016 · 16 comments
Assignees

Comments

@123AndGo
Copy link

Hello, since yesterday (21/01/2016) our group chats aren't working because we get no response after calling the QB.chat.muc.join(dialogJid) method. We also see that automatic "presence" messages also don't get any responses.

The users login and connect to the chat (QB.chat.connect()) without any problem, but the join method suddenly stopped working without us having made any changes.

You can test this issue with this code (we have tested it on v1.16.1 and v2.0.3 of the SDK):

var CONFIG = {  
    chatProtocol: {
        active: 2 // set 1 to use BOSH, set 2 to use WebSockets (default)
    },
    debug: {mode: 1} // set DEBUG mode
};

var CREDENTIALS = {
  appId: 34012,
  authKey: 'pwSCOResb4R2Lka',
  authSecret: 'E4sztXGxw5Qk8md'
};

QB.init(CREDENTIALS.appId, CREDENTIALS.authKey, CREDENTIALS.authSecret, CONFIG);

QB.createSession(function(e, r){
    var params = {login: 'test@test.com', password: '12345678'};
    QB.login(params, function(e,r){
        if(r) {                        
            QB.chat.connect({userId: r.id, password: '12345678'}, function(e,roster){
                if(!e){
                    QB.chat.muc.join("34012_56a15ec7a0eb4791ae0003cc@muc.chat.quickblox.com",function(r){console.log(r);});
                }
            });
        }
    });
});

And this are the screenshots of the console logs:
ss1
ss2
ss3

This is really urgent for us because we haven't been able to do any further development and we have a very close deadline for launching the chat feature of our group dating app, so we would really appreciate your help.

Thank you very much. All my best.

@123AndGo
Copy link
Author

Hello again! I've just performed a new test by creating a test app on a co-developer's account and on that account everything is working well, so the problem seems to be with my developer's account.

I checked if maybe there was some mistake that caused a massive API calls avalanche but I see in the stats page that the amount of my app's API calls count is very low. So, I don't know what caused this blocking on my account.

I would really appreciate your help on un-blocking my account. All my best.

@juvaly
Copy link

juvaly commented Jan 23, 2016

I'm having the same issue. Callback from join not firing.

EDIT: The callback is fired, and i can send messages, when i use the account owner user. For any other user it doesn't work.

@coredream
Copy link

I'm experiencing the exact same problem, but with the quickblox-ios-sdk (just adding to this thread since I was curious if anyone else was having this problem). Callback from join not firing in my iOS app:

[dialog joinWithCompletionBlock:^(NSError *error)

I also started seeing this on Jan 21.

@dimaspirit
Copy link
Contributor

Hi everyone, could you check this one more time? And will confirm if the issue still reproduce.

@dimaspirit dimaspirit self-assigned this Jan 25, 2016
@juvaly
Copy link

juvaly commented Jan 25, 2016

seems to be working now. what was the problem?

@dimaspirit
Copy link
Contributor

Good!
It looks like we had a problem on the server side, but we fixed.

@123AndGo
Copy link
Author

It is working for us too. Thank you very much!

@himanshunimje
Copy link

himanshunimje commented Jun 17, 2016

I seem to be having this problem now. While using the function retrieveChatDialogs(), browser console is showing an error on the following lines of code:

// join room
        if (item.type != 3) {
          QB.chat.muc.join(item.xmpp_room_jid, function() {
             console.log("Joined dialog "+dialogId);
          });
        }

Attaching the browser console for further clarity.

screen shot 2016-06-17 at 2 57 50 pm

Is this an issue on server side or do I need to change the code from my end? The exact same code was working perfectly fine yesterday, but I am receiving this error today.

@k1master
Copy link

k1master commented Jun 21, 2016

I also have that issue. Code is nearly all the same with sample chat app. Finally, I replaced all the credentials in the sample chat app, and it's not working either. It seems like my qb account is not working for group chat. Why is this happening?
There aren't many api calls.

@k1master
Copy link

I have found the a thing. Maybe it could help solving this issue.
It works with the users I made in admin panel when I join to group chat. That group chat was also made in admin panel. But when I try to join the group chat that is made from server backend, which calls QB Restful API, it doesn't work.

@dimaspirit
Copy link
Contributor

Hi everybody,
yes, we have the issue on backend side.
We need to know endpoints of your instance (if you don't use QB instance) to fix that issue.
So, write here what instance you use and we will fix it.

@k1master
Copy link

I have figured out.
In my case, the reason was from your session creation API.
API Documentation says to use [POST] /session.json, but the users with this API is not working for group chat. I used /auth.json for session creation and used signup RESTful api, and it is working now.
This is not account problem.
I think you should check that API or update documentation.

@himanshunimje
Copy link

Hi,

I am using the javascript SDK to create session and login a QB user. Hence, following are the javascript lines of code which uses quickblox.min.js to access the API's:

var params = { 'login': 'testuser_1', 'password': '*********'}; QB.createSession(function(err, res) { QB.login(params, function(err, user){ setupStickerPipe(); retrieveChatDialogs(); setupAllListeners(); setupMsgScrollHandler(); } }

Let me know if this is the information that you needed.

@k1master
Copy link

k1master commented Jun 23, 2016

@himanshunimje , your problem can be fixed by calling QB.chat.connect() function.
Please refer this code.

QB.createSession(credentials, function(err, result){
                if (result){ // session created? (login success)
                    console.log(result);

                    credentials.user_id = result.user_id;

                    QB.chat.connect({
                        userId: result.user_id,
                        password: credentials.password
                    }, function(err, res){
                        if (res){
                            console.log(res);

                            QB.chat.dialog.list(null, function(err, dialogs){
                                dialogs.items.forEach(function(dlg, i, arr){
                                    if (dlg.name.startsWith('call')){
                                        return;
                                    }
                                    if (dlg.type == 2){
                                        service.chatIds[dlg._id] = false;
                                        QB.chat.muc.join(dlg.xmpp_room_jid, function(){
                                            service.chatIds[dlg._id] = true;
                                            console.log("Joined dialog " + dlg._id + " xmpp " + dlg.xmpp_room_jid);
                                        });
...

This code works with users that are created using session from /auth.json API, but /session.json API.

@himanshunimje
Copy link

@Alex--Jin : That solves the issue. Thanks for helping out.

PS: I am getting the following error in browser console while retrieving chat dialogs of a user i.e. using the same retrieveChatDialogs() function:

Uncaught InvalidStateError: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.

I am assuming that this is an invalid state error which gets solved when the WebSocket is connected. Should I be worried about this error?

@k1master
Copy link

No. You don't need.
@himanshunimje

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants