-=-=-=-=

Tuesday, January 10, 2017

How does WhatsApp technology works?

Whats App is Chat application. WhatsApp is a texting service between mobile phones as a replacement for the regular SMS text messages. Over millions users are active worldwide using the Whatsapp service. Whatsapp uses an internet connection between phones. The service is available for iPhone, Blackberry, Android and Nokia Symbian60-phones.

How does WhatsApp technology works?
The major difference between regular SMS text messages and Whatsapp text messages is that Whatsapp is free: You use the internet connection on your phone (wifi or part of you mobile data package depending on subscription or pre paid type).

We call them Instant Messaging.  This means the messaging between sender and receive should happen in real time, unlike email (offline).

So you need to first understand challenge here to understand how chat apps work.  If you store something on database, then you pass again to another user, it becomes offline (not in real time).  If you pass any message and it stores and also pass at same to other user, it becomes IM (Instant messaging). 

Now in development, there are different PROTOCOLS that help achieve things.

For Emails its: SMTP, POP3 etc.
For Chat its: XMPP (Extensible Messaging and Presence Protocol)

It is protocol based on another format named XML (like html, not exactly, but to give you idea).  Using XMPP protocol, XML as communication medium and setting up this on a server, that host it and helps pass all communication and also setup logic on this server (Basically coding).  So there are many server created with protocol XMPP like eJabber.

Interestingly, WhatsApp is related to "Yowsup" , a Python library.  Python is a programming language on which Quora, YouTube etc. are built! You can find this Yowsup library on tgalal/yowsup.

So now lets put together all above information.
A user A has internet and a client application (whats app) installed on say Android phone), A user B has internet and has same client application (Whatsapp) installed on his iPhone. (So basically cross platform).

A types message "Hi" to B.  The message is passed via Web Services to XMPP server, The XMPP server has list of all WhatsApp user, based on unique phone number, it will detect B and XMPP server will then send message "Hi" to B with web service.  B will recieve this message on iPhone.  In between there will coding done with business rules on server, database level and on client applications as well. 

Whatsapp is implemented at server end over the protocol XMPP. Exactly it is done on XMPP lite which is well established open source chat engine. 

XMPP (Extensible Messaging and Presence Protocol)
What is the Technology behind WhatsApp?
WhatsApp uses a customized version of the open standard Extensible Messaging and Presence Protocol (XMPP) upon installation. WhatsApp automatically compares all the phone numbers from the device's address book with its central database of WhatsApp users to automatically compares all the phone numbers from the devices address book with its central database of WhatsApp users to automatically add contacts to the users WhatsApp contact list.

XMPP

What is Extendible Messaging and Presence Protocol (XMPP) ?
The Extensible Messaging and Presence Protocol (XMPP) is an application profile of the Extensible Markup Language (XML) for streaming XML data in close to real time between any two or more network-aware entities. The address format for XMPP entities was originally developed in the Jabber Open Source Community in 1999. It functions between or among servers, and facilitates near-real-time operation. The Protocol may eventually allow internet users to send instant messages to anyone else on the Internet, regardless of differences in Operating systems and browsers. 

XMPP is sometimes called the Jabber protocol, but this is a technical misnomer. Jabber, an IM application similar to ICQ (I Seek You) and others, is based on XMPP, but there are many applications besides Jabber that are supported by XMPP. The IEEE XMPP working group, a consortium of engineers and programmers, is adapting XMPP for use as an Internet Engineering Task Force (IETF) technology. 

In addition, the Messaging and Presence Interoperability Consortium (MPIC) is considering XMPP as an important interoperability technology. Eventually, XMPP is expected to support IM applications with authentication, access control, a high measure of privacy, hop-by-hop encryption, end-to-end encryption, and compatibility with other protocols.


Database management
For the database management Mnesia DB comes into play. Mnesia is a multiuser distributed DBMS which happens to be the default DB of ERLANG. Thus by using Mnesia, the app is able to achieve quicker request responses, thereby improving the overall efficiency.

FreeBSD is the operating system upon which WhatsApp is laid upon. Improvising on the ERLANG based applications and optimizing FreeBSD, WhatsApp is able to achieve better throughput. For storing multimedia files, the app uses an exclusive web server YAWS.

3 comments:

  1. You are a realy knowledgeable person. Great article thaka for sharing.
    Visit my website and give me some suggestion to move it up
    Http://ansnetwork.in

    ReplyDelete