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
  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. Images and videos are sent in WhatsApp using the following steps:

    Open WhatsApp: Launch the WhatsApp application on your device.

    Select Contact or Group: Choose the contact or group chat to which you want to send the image or video.

    Access Attachment Menu: Look for the attachment icon, usually represented by a paperclip or "+" sign, depending on your device. Tap on this icon to access the attachment menu.

    Choose Media: From the attachment menu, select the option to attach media. This may be labeled as "Gallery," "Photo & Video Library," or similar, depending on your device.

    Select Image/Video: Browse through your device's gallery or camera roll to choose the image or video you want to send. Tap on the image or video to select it.

    Add Caption (Optional): If desired, you can add a caption to the image or video before sending it. This caption will appear alongside the media when it is received by the recipient.

    Send: Once you have selected the image gb whatsapp download or video and, optionally, added a caption, tap the send button (usually represented by a paper plane icon) to send the media to the selected contact or group.
    By following these steps, you can easily send images and videos to your contacts or groups using WhatsApp.

    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

Controlling bandwidth usage in WebRTC (and how googSuspendBelowMinBitrate works)