Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8958389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:12:08+00:00 2026-06-15T15:12:08+00:00

I’m trying to Implement chat module in my app. I am successfully done with

  • 0

I’m trying to Implement chat module in my app. I am successfully done with Login and Register process from Simple Chat Demo into my app. It also returns user array of offline and online users.

Now after successfully log in I am getting below log :-

error:
2012-12-07 14:50:07.056 App[5324:790b] QBChatService/xmppStreamDidConnect
2012-12-07 14:50:08.285 App[5324:790f] QBChatService/xmppStreamDidAuthenticate
2012-12-07 14:51:08.291 App[5324:711f] QBChatService/xmppStreamDidDisconnect, error=Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo=0xb982330 {NSLocalizedDescription=Socket closed by remote peer}

And I’m not able to receive chat messages into my app.

Any suggestions ?

Edit :-

In my app, when login is done I am sending the login request to QuickBlox API

if(loginDone)
{
     NSString *userName = [_textUsername.text stringByReplacingOccurrencesOfString:@"@" withString:@"_"];
     NSString *userPass = [_textPassword.text stringByReplacingOccurrencesOfString:@"@" withString:@"_"];

     // Authenticate user
     [QBUsers logInWithUserLogin:userName password:userPass delegate:self context:userPass];
} 

 #pragma mark -
#pragma mark QBActionStatusDelegate

// QuickBlox API queries delegate
-(void)completedWithResult:(Result *)result  context:(void *)contextInfo
{    
    // QuickBlox User authentication result
    if([result isKindOfClass:[QBUUserLogInResult class]])
    {
        // Success result
        if(result.success)
        {
            QBUUserLogInResult *res = (QBUUserLogInResult *)result;

            // save current user
            [[DataManager shared] setCurrentUser: res.user];
            NSLog(@"%@",res.user);

            [[[DataManager shared] currentUser] setPassword:(NSString *)contextInfo];
            NSLog(@"%@",res.user);

            // Login to Chat
            [QBChat instance].delegate = self;
            [[QBChat instance] loginWithUser:[[DataManager shared] currentUser]];

            // Register as subscriber for Push Notifications
            [QBMessages TRegisterSubscriptionWithDelegate:nil];

            // send request for getting user's filelist
            PagedRequest *pagedRequest = [[PagedRequest alloc] init];
            [pagedRequest setPerPage:10];

            [QBContent blobsWithPagedRequest:pagedRequest delegate:self];

            [pagedRequest release];
        }
        else
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Errors"
                                                            message:[result.errors description]
                                                           delegate:self
                                                  cancelButtonTitle:@"Ok"
                                                  otherButtonTitles: nil];
            alert.tag = 1;
            //[alert show];
            [alert release];

            [HUD hide:YES];
            [self AfterLoginController];
        }
    }
}

-(void)completedWithResult:(Result *)result
{
    if([result isKindOfClass:[QBUUserLogInResult class]]) // QuickBlox User authentication result
    {
        // Success result
        if(result.success)
        {
            // If we are authenticating through Twitter/Facebook - we use token as user's password for Chat module
            [self completedWithResult:result context:[BaseService sharedService].token];
        }
    }
    else if ([result isKindOfClass:[QBCBlobPagedResult class]])
    {
        // Success result
        if(result.success){
            QBCBlobPagedResult *res = (QBCBlobPagedResult *)result;

            // Save user's filelist
            [DataManager shared].fileList = [[res.blobs mutableCopy] autorelease];

            AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
            [app startsendPresenceTimer];

            [HUD hide:YES];            
            [self AfterLoginController];
        }
    }
    else
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Errors"
                                                        message:[result.errors description]
                                                       delegate:self
                                              cancelButtonTitle:@"Ok"
                                              otherButtonTitles: nil];
        alert.tag = 1;
        //[alert show];
        [alert release];

        [HUD hide:YES];
        [self AfterLoginController];
    }
}

Now in AppDelegate :-

- (void) startsendPresenceTimer
{
    [QBChat instance].delegate = self;

    // send presence
    if(self.sendPresenceTimer == nil)
    {
        self.sendPresenceTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(sendPresence) userInfo:nil
                                                                 repeats:YES];
    }

    if (self.requesAllUsersTimer == nil)
    {
        self.requesAllUsersTimer= [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(updateUsers) userInfo:nil repeats:YES];
    }
    [self.requesAllUsersTimer fire];
}

// send presence
- (void)sendPresence{
    // presence in QuickBlox Chat
    [[QBChat instance] sendPresence];
    // presence in QuickBlox
    [QBUsers userWithExternalID:1 delegate:nil];
}

- (void)updateUsers
{
    // Retrieve all users
    PagedRequest* request = [[PagedRequest alloc] init];
    request.perPage = 100; // 100 users
    [QBUsers usersWithPagedRequest:request delegate:self];
    [request release];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:12:09+00:00Added an answer on June 15, 2026 at 3:12 pm

    Do you send presence periodically? It need because Chat server must knows is you online or offline.

    Look at QuickBlox Chat setup guide, lines

    Keep in mind that QuickBlox it’s simple XMPP chat, …

    Just write single line

    [NSTimer scheduledTimerWithTimeInterval:30 target:[QBChat instance] selector:@selector(sendPresence) userInfo:nil repeats:YES];
    

    Application will send presence every 30 seconds

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.