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 6868037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:23:05+00:00 2026-05-27T03:23:05+00:00

I am trying to build a simple Jabber client. I have downloaded this sample

  • 0

I am trying to build a simple Jabber client.
I have downloaded this sample project, which uses xmpp-framework https://github.com/funkyboy/Building-a-Jabber-client-for-iOS
I am running it in the iOS Simulator. I have installed Openfire locally so that I can interact with a user logged into iChat.

Unfortunately the app only receives messages. It fails in sending messages giving the error “TURN Connection failed!”.

This is the code attempting to connect:

- (void)viewDidLoad 
{
    [super viewDidLoad];
    self.tView.delegate = self;
    self.tView.dataSource = self;
    [self.tView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

    messages = [[NSMutableArray alloc ] init];

    JabberClientAppDelegate *del = [self appDelegate];
    del._messageDelegate = self;

    [self.messageField becomeFirstResponder];

    XMPPJID *jid = [XMPPJID jidWithString:@"user@server.local"];

    NSLog(@"Attempting TURN connection to %@", jid);

    TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:[self xmppStream] toJID:jid];

    [turnSockets addObject:turnSocket];

    [turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
    [turnSocket release];   
}

And those are the methods called on success/failure:

- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket 
{   
    NSLog(@"TURN Connection succeeded!");
    NSLog(@"You now have a socket that you can use to send/receive data to/from the other person.");

    [turnSockets removeObject:sender];
}

- (void)turnSocketDidFail:(TURNSocket *)sender 
{   
    NSLog(@"TURN Connection failed!");
    [turnSockets removeObject:sender];
}

Can anyone please help?
Thank you.

  • 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-05-27T03:23:05+00:00Added an answer on May 27, 2026 at 3:23 am

    There is no reason to use TURN for normal messaging. TURN is required for media streaming only. Just use XMPPFramework. There are some good getting-started guides.

    Next, use code of this nature to create and send stanzas:

    XMPPMessage *msg = [XMPPMessage message];
    [msg addAttributeWithName:@"type" stringValue:@"chat"];
    [msg addAttributeWithName:@"to" stringValue:@"foo@example.com"];
    NSXMLElement *body = [NSXMLElement elementWithName:@"body" stringValue:@"Hello"];
    [msg addChild:body];
    [[self xmppStream] sendElement:msg];
    

    Note that msg is just a subclass of NSXMLElement, so you can modify the XML at will to craft the protocol you’re going to send.

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

Sidebar

Related Questions

I'm currently trying to build a simple component which should monitor, if the user
Im trying to build a simple, lightweight product viewer using jquery. I have a
I'm trying to build a simple application, with the finished program looking like this
I am trying to build a simple java program which creates a db file,
Im trying to build a simple AJAX script that uses a form to send
I'm trying to build a simple web service which return a list of shows
I'm trying to build a simple component extending spark.components.Group to have a background color,
I'm trying to build a simple site but I'm just blocking on this weird
I am trying to build a simple div based popup which can be used
I'm trying to build simple facebook application with 4.2.1 C# SDK. But I have

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.