简体   繁体   中英

What is XMPP, and how can I use it within an iOS chat application?

I want to create a chat client application for iPhone. I've read that the XMPP framework is one of the best to use for this. However, I haven't found much material out there on this, only the XMPPFramework on Google Code and details about it on a wiki.

Can anyone explain what XMPP is and how we can use it within our chat application? Are there any tutorials or code snippets out there that demonstrate its use?

XMPP is an open protocol for messaging and presence that most IM clients support.

If you're building a chat app for iOS that needs to interact with other clients, use XMPP. Read up and understand the protocol first, then look at the XMPPFramework Objective-C lib and it should all make sense. It'll take some time to learn though.

If your chat app needs to only communicate with other installations of your app, then you have a few easier options:

You could open a persistent tcp connection with the server and use that to pass presence and message data back and forth. You could implement a simple server to do this in node.js, for example, in a relatively small amount of code.

An even easier option is to call a simple http based api when you want to report new messages or presence changes from the iphone and deliver updates via push messages. Push messages are good because when the app is closed you can still deliver the message and when the app is open you can intelligently update your app's interface.

It's all about your requirements.

V. Have you implemented XMPP?
I know it's too late to answer, but as now a days I am working on XMPP iOS app, and now we are having comparatively much information available over XMPP, I feel to write here.

Here is one of the best tutorial available for integrating XMPP:

1. Building a jabber client for iOS
2. XMPP Messanger for iOS - GitHub

It is very powerful and really instant protocol to use for IM (as we all know hoe WhatsApp is using it).

We can even integrate OMEMO Encryption for our IM App.

The most known XMPP iOS framework is XMPPFramework . It provides a core implementation of RFC-3920 (the XMPP standard). The framework is massively parallel and thread-safe. Performance is good thanks to GCD. It comes with multiple popular extensions (XEP's).

You can find a very well written Swift tutorial to implement XMPPFramework in your application. Here is the first part and the second part

Alternative can be:

  • DCXMPP but it hasn't been maintained since 2014.
  • Libstrophe which is a C library. You can find an iOS version here . Same it hasn't been maintained since 2013

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM