venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.14k forks source link

On Mobile Whatsapp, how the socket behave? how it's different with WhatsAPI socket (whatsapp.php)? #735

Open c2js opened 10 years ago

c2js commented 10 years ago

Hi,

Might be some body asked this type of question before, but I can't find any by search.

Is anyone know how Mobile Device's Whatsapp (Client) behave in term of socket? is every single message send: open socket -> auth -> send msg -> receive msg -> close socket?

or actually the socket is open for some period of time before it close? What condition trigger a Mobile Whatsapp socket close?

As far as I know, how WhatsAPI does is every single request (whatsapp.php) is follow this sequence open socket -> auth -> receive msg -> send msg -> close socket. every request open the socket once.

is that normal behavior to keep auth (login) with whatsapp server frequently?

shirioko commented 10 years ago

No. Whatsapp client connects and authenticates when you open the app. Any message you send or receive goes through that socket connection. The socket is closed when you exit the app on your phone. At that point the app subscribes to GCM, Apple cloud notifications or Microsoft push framework.