微信、whatsapp 和其他即时通讯应用背后的技术是什么? [英] What is the technology behind wechat, whatsapp and other messenger apps?

查看:27
本文介绍了微信、whatsapp 和其他即时通讯应用背后的技术是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想知道不同实时通讯应用的架构.他们是否使用任何通用协议/架构?

I am eager to know about the architecture of different real-time messenger apps. Are they using any generic protocol/architecture?

推荐答案

Facebook 以 190 亿美元购买的 WhatsApp 架构 解释了 whatsapp 设计所涉及的架构.

The WhatsApp Architecture Facebook Bought For $19 Billion explains the architecture involved in design of whatsapp.

这里是链接的一般解释

  • WhatsApp 服务器几乎完全在 Erlang 中实现.

  • WhatsApp server is almost completely implemented in Erlang.

执行后端消息路由的服务器系统在 Erlang 中完成.

Server systems that do the backend message routing are done in Erlang.

伟大的成就是用非常小的服务器空间来管理活跃用户的数量.团队一致认为这很大程度上是因为 Erlang.

Great achievement is that the number of active users is managed with a really small server footprint. Team consensus is that it is largely because of Erlang.

有趣的是,Facebook Chat 是在 2009 年用 Erlang 编写的,但由于很难找到合格的程序员,因此他们放弃了.

Interesting to note Facebook Chat was written in Erlang in 2009, but they went away from it because it was hard to find qualified programmers.

WhatsApp 服务器已从 ejabberd 启动

WhatsApp server has started from ejabberd

Ejabberd 是著名的开源 Jabber 服务器,用 Erlang 编写.

Ejabberd is a famous open source Jabber server written in Erlang.

最初选择它是因为它是开放的、受到开发人员的好评、易于启动以及 Erlang 对大型通信系统的长期适用性的承诺.

Originally chosen because its open, had great reviews by developers, ease of start and the promise of Erlang’s long term suitability for large communication system.

在接下来的几年里,我们对 ejabberd 的很多部分进行了重写和修改,包括从 XMPP 切换到内部开发的协议,重构代码库和重新设计一些核心组件,以及对 ejabberd 进行了许多重要的修改Erlang VM 优化服务器性能.

The next few years were spent re-writing and modifying quite a few parts of ejabberd, including switching from XMPP to internally developed protocol, restructuring the code base and redesigning some core components, and making lots of important modifications to Erlang VM to optimize server performance.

为了每天处理 500 亿条消息,重点是打造一个可靠的系统.货币化是以后要考虑的事情,它还有很远的路要走.

To handle 50 billion messages a day the focus is on making a reliable system that works. Monetization is something to look at later, it’s far far down the road.

衡量系统健康状况的主要指标是消息队列长度.一个节点上所有进程的消息队列长度受到持续监控,如果它们的积压超过预设阈值,则会发出警报.如果一个或多个进程落后于该进程,则会发出警报,指示下一个要攻击的瓶颈.

A primary gauge of system health is message queue length. The message queue length of all the processes on a node is constantly monitored and an alert is sent out if they accumulate backlog beyond a preset threshold. If one or more processes falls behind that is alerted on, which gives a pointer to the next bottleneck to attack.

通过上传要发送到 HTTP 服务器的图像、音频或视频,然后发送指向内容的链接及其 Base64 编码缩略图(如果适用)来发送多媒体消息.

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

通常每天都会推送一些代码.通常,它一天多次,但通常会避免高峰交通时间.Erlang 有助于积极地将修复和功能投入生产.热加载意味着无需重启或流量转移即可推送更新.错误通常可以很快消除,再次通过热加载.系统往往更加松散耦合,这使得逐步推出更改变得非常容易.

Some code is usually pushed every day. Often, it’s multiple times a day, though in general peak traffic times are avoided. Erlang helps being aggressive in getting fixes and features into production. Hot-loading means updates can be pushed without restarts or traffic shifting. Mistakes can usually be undone very quickly, again by hot-loading. Systems tend to be much more loosely-coupled which makes it very easy to roll changes out incrementally.

Whatsapp 应用程序使用什么协议?连接到 WhatsApp 服务器池的 SSL 套接字.所有消息都在服务器上排队,直到客户端重新连接以检索消息.消息的成功检索被发送回 whatsapp 服务器,该服务器将此状态转发回原始发件人(它将在消息旁边看到一个复选标记"图标).一旦客户端接受消息,消息就会从服务器内存中擦除

What protocol is used in Whatsapp app? SSL socket to the WhatsApp server pools. All messages are queued on the server until the client reconnects to retrieve the messages. The successful retrieval of a message is sent back to the whatsapp server which forwards this status back to the original sender (which will see that as a "checkmark" icon next to the message). Messages are wiped from the server memory as soon as the client has accepted the message

Whatsapp 内部的注册流程是如何运作的?WhatsApp 曾经根据手机 IMEI 号码创建用户名/密码.这是最近改变的.WhatsApp 现在使用来自应用程序的一般请求来发送唯一的 5 位 PIN 码.然后 WhatsApp 会向指定的电话号码发送 SMS(这意味着 WhatsApp 客户端不再需要在同一部手机上运行).然后,应用程序根据密码从 WhatsApp 请求一个唯一的密钥.该密钥用作密码".对于所有未来的电话.(此永久"密钥存储在设备上).这也意味着注册新设备会使旧设备上的密钥失效.

How does the registration process work internally in Whatsapp? WhatsApp used to create a username/password based on the phone IMEI number. This was changed recently. WhatsApp now uses a general request from the app to send a unique 5 digit PIN. WhatsApp will then send a SMS to the indicated phone number (this means the WhatsApp client no longer needs to run on the same phone). Based on the pin number the app then request a unique key from WhatsApp. This key is used as "password" for all future calls. (this "permanent" key is stored on the device). This also means that registering a new device will invalidate the key on the old device.

这篇关于微信、whatsapp 和其他即时通讯应用背后的技术是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆