בירור | אפליקציית ווצאפ
-
@elchanan כתב בבירור | אפליקציית ווצאפ:
יש למשהו מושג באיזה פרוטוקול עובר התעבורה (wss וכו')
-
@elchanan כתב בבירור | אפליקציית ווצאפ:
@MGM-IVR
זה חסום בנטפרי
תוכל להעתיק את מה שכתוב שםFrom a quick search on the internet it looks like Whatsapp uses a custom XMPP server built on Erlang to handle the messaging backend. The advantage of using XMPP is it comes with built in support for rosters and presence so you don't have to manually setup infrastructure and code to manage subscriptions.
Like one-to-one communication XMPP also provides you support for multi user chat which more or less just relays the messages to all users in a given chatroom. Here is a tutorial on how to do that with Ruby but it should give you a good idea of the underlying principle MultiUser Chat using XMPP and Orbited (Using Ruby-on-Rails). In my opinion REST based server consuming messages with a long-polling server or Websockets should help you fetch the data from the backend. I would recommend looking into StropheJS An XMPP library for JavaScript or Orbited orbited2. Orbited allows for a socket like interface with javascript and works on top of Twisted. Though I'm not familiar with the Java ecosystem I've found that the Play Framework and Lift for Scala come with built in support for long polling.
However lately, I've grown partial to messaging middleware which happens to give me more flexibility to achieve the same the features. Though this means that you would have to manage the presence and rosters list yourself. I would recommend looking into Kafka or Rabbitmq. Even Redis comes with a fairly scalable pubsub feature which would help you build message queues (as Redis Lists) and publish subscribe features.
REST based APIs make it easy to work with HTTP requests so every message would be "POSTed" to the server and handed to the your messaging layer or your XMPP server if your working with Ejabberd or Openfire.
The message if fetched by periodically polling with a (GET) long connection timeout - which basically waits till some data arrives on the backend to make it look realtime. Websockets on the other hand would make it more event based.
REST simply defines a set of rules to access the resource behind it.
JSON is just another way to exchange data over the web much like XML.
SOAP is another means of exchanging data using predefined XML schemas which help standardise the format in which messages are exchanged.
With Whatsapp there aren't 10 different socket connections (to the best of my knowledge) but periodic long polls which wait for new data to arrive.
From your requirement I feel Kafka or Rabbitmq or Redis would be better suited to implement it. The RabbitMQ site has beautifully documented the features available and would be a great place to start.
ההודעה מלפני 8 שנים