What is technology for wechat, whatsapp and other messaging apps?

I really want to know about the architecture of various real-time instant messaging applications. Do they use any common protocol / architecture?

+42
architecture smartphone protocols messenger
Oct 28 '13 at 16:57
source share
4 answers

WhatsApp architecture Facebook bought for $ 19 billion explains architecture related to whatsapp design.

Here is a general explanation from the link

  • WhatsApp server is almost completely implemented in Erlang.

  • Server systems that route the firewall are running in Erlang.

  • The big achievement is that the number of active users is managed with a very small server size. The team consensus is that it is largely due to Erlan.

  • It is interesting to note that Facebook chat was written in Erlang in 2009, but they left it because it was difficult to find qualified programmers.

  • Whatsapp server started with ejabberd

  • Ejabberd is a well-known open source Jabber server written in Erlang.

  • Originally chosen because it was opened, they had excellent developer reviews, ease of start and the promise of a long-term perspective for Erlangs for a large communication system.

  • The next few years were spent re-recording and modifying several parts of ejabberd, including moving from XMPP to an internally developed protocol, restructuring the code base and redesigning some of the core components, and making a lot of important changes to Erlang VM to optimize server performance.

  • To process 50 billion messages per day, the focus is on creating a reliable system that works. Monetization is what you need to see later, it is far along the road.

  • The primary sensor for system health is the length of the message queue. The message queue duration of all processes on a node is constantly monitored, and an alert is sent if they accumulate a lag for a given threshold. If one or more processes are behind what is being warned, giving a pointer to the next bottleneck to attack.

  • Multimedia messages are sent by uploading an image, audio or video to be sent to an HTTP server, and then sending a link to the content along with its thumbnail encoded in Base64 (if applicable).

  • Some codes are usually popped every day. Often it is several times a day, although in general peak traffic times are avoided. Erlang helps to be aggressive in getting fixes and features into production. A hot download means that updates can be migrated without restarting or switching traffic. Errors can usually be undone very quickly, again by hot boot. Systems, as a rule, are much more loosely coupled, which makes it very easy to download changes gradually.

  • What protocol is used in Whatsapp? SSL to WhatsApp server pools. All messages are queued on the server until the client reconnects to retrieve the messages. Successful message retrieval is sent back to the whatsapp server, which redirects this status to the original sender (who sees this as a check mark next to the message). Messages are deleted from the server memory as soon as the client receives the message

  • How does the registration process work inside Whatsapp? WhatsApp is used to create a username / password based on the IMEI phone number. This has recently been changed. WhatsApp now uses a generic application request to send a unique 5-digit PIN. Then WhatsApp will send an SMS to the indicated phone number (this means that the WhatsApp client no longer needs to run on the same phone). Based on the number of the contact application, the application requests a unique key from WhatsApp. This key is used as a β€œpassword” for all future calls. (this "permanent" key is stored on the device). It also means that registering a new device will invalidate the key on the old device.

+44
Mar 19 '15 at 4:40
source share

As far as I know, Ejabberd ( http://www.ejabberd.im/ ) is the parent, it is an XMPP server that provides good open source features, Whatsapp uses some modified version of this, facebook messaging also uses a modified version of this. Some chat applications like Samsung ChatOn, Nimbuzz messenger use ejabberd, and Erlang solutions also have a modified version of this ejabberd, which they claim is highly scalable and well tested with a large increase in performance and renamed MongooseIM.

Ejabberd is a server on which most of the functions are implemented compared to others. Since it is built in Erlang, it scales horizontally.

+24
Dec 16 '13 at 17:51
source share

WhatsApp chose the Erlang language, designed to write scalable applications for troubleshooting. Erlang uses an abstraction called the Actor model for her concurrency - http://en.wikipedia.org/wiki/Actor_(programming_language) Instead of the traditional approach to shared memory, participants exchange messages by sending messages to each other. Actors, unlike threads, are designed for light weight. Actors can be on the same machine or on different machines, and paragraphs that transmit messages work for both. A simple WhatsApp implementation could be: Each user / device is presented as an actor. This subject is responsible for processing the user's incoming messages, how they are serialized to disk, messages that the user sends, and messages that the user receives. Suppose Alice and Bob are friends on WhatsApp. So, there is Alice's actor and Bob's actor.

Allows you to trace a number of messages coming back and forth:

Alice decides to inform Bob. The Alice phone establishes a connection with the WhatsApp server, and it is established that this connection is definitely connected to the Alice phone. Alice now sends the following message over TCP: "For Bob: a giant monster attacks the Golden Gate Bridge." One of the WhatsApp Fronts servers deserializes this message and delivers this message to Alice actor.

Alice, the actor decides to serialize this and store it in the file "Alice Sent Messages" stored in the replicated file system to prevent data loss due to the unpredictable corruption of monsters. Then Alice decides to pass this message to Bob to the actor, passing him the message "Msg1 from Alice: a giant monster is attacking the Golden Gate Bridge." Alice actor can repeat exponentially until Bob actor acknowledges receipt of the message.

Bob actor eventually receives a message from (2) and decides to save this message in a file called "Bob's Inbox." After he saves this message for a long time, Bob actor will confirm receipt of the message by sending Alice his message to the actor, saying: "I received Msg1." Alice actor can now stop trying again. Bob actor then checks to see if Bob's phone has an active connection to the server. This happens, and so Bob actor transmits this message to the device via TCP.

Bob sees this message and replies, "For Alice: Let them create giant robots to fight them." This now gets Bob the actor, as shown in step 1. Bob the actor repeats steps 2 and 3 to make sure that Alice ultimately gets an idea that will save humanity.

WhatsApp actually uses the XMPP protocol instead of the more advanced protocol that I outlined above, but you get the point.

+21
Jul 26 '14 at 6:08
source share

I read about it: Extensible Messaging and Presence Protocol (XMPP); Erlang;

Ref .: http://www.erlang-factory.com/upload/presentations/558/efsf2012-whatsapp-scaling.pdf

+9
Dec 16 '13 at 17:00
source share



All Articles