XMPP-Chat-Server-For-Android-And-IOS-App

XMPP chat server for Android and iOS App.!

XMPP (Extensible Messaging and Presence Protocol)

  • Originally known as Jabber, it is an open standard communications protocol for message-oriented middle-ware based on XML (Extensible Markup Language).

  • It is mainly aimed for instant messaging (IM) and online presence detection

  • It allows internet users to send instant message alerts to anyone online, regardless of differences in operating systems and browsers.

  • It enables the near-real-time exchange of structured yet extensible data between any two or more network entities.

  • It uses an open systems approach of development and application, unlike other instant messaging protocols.

What is XMPP Chat Server ?

It provides basic features of messaging, presence, and XML routing.

You can run your own XMPP service with the help of his Jabber/XMPP server software, either on a local area network or over the Internet.

See full list in the XMPP software servers.

What are the Alternatives for XMPP Chat Server ?

While communicating between devices over TCP/IP,  ‘XMPP (jabber)’ is proven to be nearly perfect. ‘ejabberd’ software is the most solid open source server stack for XMPP. It is designed for lightweight performance and durability, and written in ‘Erlang’. It scales very well horizontally and is easy to manage and integrated in little time.

It depends upon the platforms you support, in case of ‘client stack’, e.g. you can choose ‘gloox’ for Windows, OSX, and linux and ‘XMPP-Framework’ for iOS integration.

However, if you need support for something else, there are a lots of alternatives you can visit for XMPP Servers and XMPP Client Libraries.

So far for instant messaging communication, XMPP has been with SIMPLE the de facto standard, created and popularized for web applications. Also, there haven’t been enough pushing by Current owner of eJabberd (Process-One), that doesn’t have an open API, and have the access to the cloud implementation of restricted eJabberd 3.

Therefore XMPP servers have no known or reliable cloud implementations on the cloud. So, you need to install and maintain your own server if you want your users to chat from your iOS app, or pay someone to do it for you.

You have options, if for your app, chatting is just a complementary part and to avoid the hassle and reduce developing hours in non-critical features of your product, or even if it’s in fact a key feature, then Cloud-based messaging services offers messaging and cache that can easily provide the required back-end for your chat application.

The prominent services among them are ‘Iron.io’ and ‘PubNub’ are.

Both of them provides messaging and cache services, along with push functions.

Iron.io : Currently, it doesn’t have a iOS SDK, so using http requests, connect their REST services. Also, the token remains visible and the technical support team strongly advise against it. It is recommend to use a server to do the credentialing with the ‘Iron.io’ servers and receiving the requests from the app. Using ‘IronMQ’ Messages are sent and stored until delivered or cached using ‘IronCache‘, Therefore, you will need two http requests to two different independent services, if you want your message delivered and stored.

PubNub offers a single configurable service, which can be used to send, deliver and store messages for short periods of time, although different pricing charged for different features. Depending on different approaches, their main services are discriminated into three different categories e.g. Pulse is based on dedicated 24/7 unicast connections and measures unique devices daily while Galaxy is based on 1-to-many broadcasts and measures daily peak connections in 1-hour slots.

In your app, use a combination of both and when you’re deployed in the global cloud, the differences largely disappear. Therefore, Pulse is ideal for private chat rooms and the Galaxy for public rooms. All the services and features are addressed by a single API, and there are a huge number of SDK’s including iOS, Android and Windows Phone.

Other XMPP Alternatives are;

Open Source.
  • OpenFire = Uses single domain only, convenient to use via web console, old project, a bit ‘spaghetti code’ having plugin architecture and easy to modify Java. Waning community support.

  • Prosody = Multi domain, new project, untested at large scale, scripting language (Lua) easy to extend. Lively community around it

  • Tigase = Open source, well supported, move quickly with regard to features scalability etc

Open Source/Commercial
  • ejabberd = Very actively developed, multi domain and mature project, written in Erlang slightly obscure and harder for developers. Some community support and commercial support from ProcessOne

Commercial
  • Isode M-Link = Good solid product with Multi-domain and respected team and active development/support.

  • Cisco – The original Jabber.com team, it’s an older very mature platform and comes with good but expensive support.

How can we enable chat logs for XMPP ?

Most clients will keep a history of your chats for you. However, that means you need to be on the same machine, using the same client to read the log.

For e.g. FastMail has the ability to log chats as emails to your account. It automatically creates a “Chats” folder in your account, and file any chat logs into that folder. This makes it easy to see and search them from anywhere.

To enable chat logs:

  • Go to the ‘Advanced → Chat Settings’ screen.
  • Select “Email logs”,  from the “Logging type” drop-down menu.

chat-logs

  • Click the “Save Changes” button.

Set up DNS for Domain

If you have a family or business account, and in your own domain, you have created users with their account names, then in order for chat to work, set up the correct SRV records for your domain.

If you host your DNS with ‘FastMail’ then correct DNS records setup automatically.

You will have to manually set up SRV records through their DNS control panel, if using an external DNS provider. As there are a huge number of DNS providers, so it will not feasible to provide explicit instructions for each one.

Add the records

_xmpp-server._tcp.yourdomain.com.
Type=SRV
TTL=3600
VALUE=”5 0 5269 chat.messagingengine.com.”

_xmpp-client._tcp.yourdomain.com.
Type=SRV
TTL=3600
VALUE=”5 0 5222 chat.messagingengine.com.”

How XMPP can be used in Android and iOS Chat Apps ?

A number of ways are there to do that. For the fastest communication, create a continuous socket or choose rest API and Push notifications for somewhat slower one.

XMPP libraries such as ‘aSmack’ can be used as the best way. Before building a mobile app, a XMPP server will be needed, such as ‘OpenFire’ or ‘eJabberd’ running on some Hosting.
Most of the popular chat apps send and receive messages with XMPP. Apps like GTalk, Watsapp etc. completely depends on XMPP protocol. A customized version of aSmack is used by popular Watsapp.

For Android App

Most Instant Messaging Clients for communication use the XMPP protocol. One of the clients, Google uses XMPP for its Google Talk Product.

A number of third party libraries are available for developing Instant Messaging client applications. ‘Smack API’ a pure Java Library is the most popular amongst XMPP client libraries. It allows developers to create IM Clients.

It is always recommended and advised to developers to go through the technical documentation and API documentation of Smack API (3.2.2 latest version), before starting to develop and explore features of Smack API.

To learn how to build a simple chat application using the Smack API, walk-through following links:

Building a Chat Application

Using Smack XMPP API from Android

Nowadays, for Android development, aSmack is obsolete and depreciated by Smack 4.1.  An open-source XMPP client library named Smack’s 4.1 version, runs natively on Android.

For more information visit at the “Smack 4.1 Readme”.

For iOS App

XMPP library is perfect to integrate chat in any iOS devices.

  1. Create your own XMPP server so that you have control over if there is any security issue. A ‘ejabberd‘ is a very popular and perfect XMPP server.

  2. You can also use some open-source XMPP servers. Depending on your use-case you have decided.

To learn how to build a Jabber Client for iOS: XMPP Setup, walk-through following link :

Building a Jabber Client for iOS: XMPP Setup

Also, ‘QuickBlox‘ Chat is a quick and reliable chat solution which combines benefits of scalable cloud hosted XMPP chat server, seamless Single Sign-On authorization via Users, incoming IM / chat alerts via Push Notifications and file attachments via Content.

QuickBlox Chat is the best and most comprehensive solution so far to have your users communicate cross-platform.

Go through following important documentation links :

QuickBlox Chat

How to work with QuickBlox Chat API (Android)?

How to work with QuickBlox Chat API (iOS) ?

An open source XMPP also known as ‘Conversations’ works with every XMPP server. XMPP is an extensible protocol. These standardized extensions are also known as XEP’s. Conversations supports a couple of these XEP’s for a better overall user experience. There is a chance that current XMPP server does not support these extensions. Therefore to get the most, you should switch to an XMPP server that does or even better run your own XMPP server for you and your friends.

These XEPs are mentioned below:

  • XEP-0065: SOCKS5 Byte streams – or rather mod_proxy65. If both parties are behind a firewall (NAT), it will be used to transfer files.

  • XEP-0138: Stream Compression, saves bandwith.

  • XEP-0198: Stream Management, helps XMPP to surive small network changes and outages of the underlying TCP connection.

  • XEP-0280: Message Carbons, automatically syncs the messages sent by you to your desktop client and within one conversation allows you to switch seamlessly from your mobile client to your desktop client and back.

  • XEP-0237: Roster Versioning, saves bandwidth on poor mobile connections.

At TBI, we have an expertise to utilize various XMPP servers and libraries in developing various Android and iOS Apps. If you have any query or suggestions related to this, we are always ready to help you as per your business needs. visit here to have a real person contact you now >>

Stay Tuned for Latest Updates

Fill out the form to subscribe to our newsletter

Partner with our experienced development team.

Contact Us
Contact Us
Loader