How are Images/Videos sent in WhatsApp?

I've been involved in the development on different IM&P services in the past and always one of the core features was the ability to share media files (audio, video, pdf...) with other users or groups.


Probably the most popular of these services was TU Me that was based on SIP but used HTTP to upload and download the files from a central storage. SIP was used to send the message with the url to the other end so that he can download the media file.

In cases where I had to use XMPP there were typically two approaches at least if you need to provide offline messaging:
  • Some inefficient inband alternatives where the media files are sent using the XMPP connection.
  • Custom (or not widely supported like xep-0363) extensions based on HTTP Uploads.
But today I was curious on how this is done in WhatsApp.  I found this opensource python implementation (yowsup) that looks great and got an idea on how it could be done but I wanted to confirm what is the protocol used by the most recent WA clients and also get some captures of the messages to see how everything looks like.

Obviously the easiest way was to use to WA Web Client because you have the Chrome developer tools in Chrome so I tried sending and receiving some files from the browser.

Sending a file

1/ Request a url to upload the media file

The first thing the client does when it needs to send a media file is to request an upload url from the server.  This is done using the signaling channel over WebSockets with a message with the action "encr_upload", the type of the content ("image" or "video") and an long id that looks like a hash of the file to be sent.


The server replies with a "status=200" and a dedicatdd url where the file has to be uploaded.  In my case the url was: https://mmg.whatsapp.net/u/f/CIX33...._kOA/Ajlc....78Xf

2/ Upload the media file

The file is uploaded to the url received in the previous message using a HTTP POST as you can see in the next capture:


It looks like if the file is uploaded encrypted (appart from using HTTPS) probably as part of the E2E encryption feature in WhatsApp.

3/ Send a message to the recipient of the media file

After the file is uploaded to the mmg.whatsapp.net server the client sends a message using the WebSocket connection to send the actual message to the other participant (yellow line in the first capture).  This message was bigger than expected (2-10K) so I thought it was very likely to include a thumbnail/preview.

I confirmed that in the receiver side.   The size of the preview image in base64 shown in the UI was more or less the size of that signaling message.

Comments

  1. WhatsApp constantly keeps updating its software to include a slew of features to provide smooth messaging and call experience to its users.

    ReplyDelete
    Replies
    1. the most popular of these services was TU Me that was based on SIP but used HTTP to upload (Image Processing Projects For Final Year) and download the files from a central storage. SIP was used to send the message with the url to the other end so that he can download the media file. Video Processing Projects

      Delete
  2. Cómo hackear whatsapp Online Gratis, Puede monitorear y ver de forma remota todos los SMS enviados y recibidos, llamadas, GPS y rutas, conversaciones de Whatsapp, Instagram y otros datos en cualquier teléfono Android.
    Hackear Whatsapp Online Gratis es una aplicación de espionaje invisible para teléfonos celulares que monitorea los datos en el dispositivo deseado, brindándole una idea real de quién está hablando con su hijo o empleado.

    ReplyDelete
  3. Don’t follow your role model. Be the Role model person for others. But it's so simple by getting Hadoop training in Chennai. Because it is an assurance course to bounce back from a double salary. For joining call 7502633633.

    ReplyDelete
  4. Real-Time Communications (RTC) refers to technologies that enable the instant exchange of voice, video, messaging, and data between users or systems with minimal delay. RTC solutions are widely used in applications such as video conferencing, online collaboration, live streaming, customer support, telemedicine, and Internet of Things (IoT) systems. Key technologies include WebRTC, Session Initiation Protocol (SIP), Voice over IP (VoIP), WebSockets, and messaging protocols that provide secure, low-latency communication across web, mobile, and desktop platforms. These technologies ensure seamless interactions by supporting real-time media transmission, signaling, and network connectivity.

    ReplyDelete
  5. The term "Real Time Communications Bits" often refers to technical insights, tutorials, tips, and updates related to RTC technologies, architectures, and best practices. IEEE Projects for CSE.Topics may include media streaming, peer-to-peer communication, NAT traversal using STUN, TURN, and ICE, signaling server implementation, network optimization, security using DTLS and SRTP, and performance monitoring. By understanding these concepts, developers and IT professionals can build scalable, secure, and high-performance communication applications that deliver reliable real-time experiences across a wide range of devices and network environments.

    ReplyDelete
  6. In my opinion, Mod APK
    s are a fantastic option for users who want to explore premium features before making a purchase. They allow people to enjoy extra functionality, unlock new experiences, and get the most out of their favorite apps and games. As long as you download from a trustworthy source and stay mindful of security, the experience can be smooth and enjoyable. Mod APKs have made many great apps more accessible, especially for users who want to test features without immediate costs. When used responsibly, they offer convenience, flexibility, and an overall better mobile experience.

    ReplyDelete
  7. The app seems easy to explore, which is one of the reasons I became interested after reading this article. I found the information about Xuper APK particularly helpful because I was looking for a simple explanation of its main features. The application appears to bring different entertainment categories together in an accessible interface. I like being able to browse around and discover content instead of always searching for a specific title. The article also gave me a better understanding of how the application fits into everyday viewing habits. Overall, it was a useful read and answered most of the questions I had.

    ReplyDelete
  8. App works smoothly most of the time, which made the sudden Login problem a little confusing. Your article was useful because it explained that several different situations can look like the same Login error. My screen kept returning to the starting page, so I checked the application version and restarted my phone before trying again. I also reviewed my Baixar Freecine installation and noticed that I had not checked the version for quite a while. The guide helped me understand the problem instead of simply telling me to reinstall the app. That step-by-step approach made the whole experience much less frustrating.

    ReplyDelete
  9. Youcine provides a convenient entertainment experience for users who enjoy discovering movies and TV shows. Its clean interface and organized categories make browsing easier, while those looking for more details can visit https://youcinedl.vip/ to explore further information about the app.

    ReplyDelete
  10. App has been a pleasant discovery for me, especially after reading your helpful article. I appreciate how clearly you described the application because it gave me a better idea of what to expect before using it. After trying Xuper Hydra APK link https://xuperhydra.net/, I found the layout easy to understand and the navigation quite natural. I liked exploring the different sections without needing to spend much time figuring everything out. The overall experience has been enjoyable so far. Thank you for putting together such useful information. Your article made it easier to understand the app and start using it comfortably.

    ReplyDelete

Post a Comment

Popular posts from this blog

Bandwidth Estimation in WebRTC (and the new Sender Side BWE)

Improving Real Time Communications with Machine Learning

WebRTC Architecture that keeps working when us-east-1 goes down