Question: how to know if someone is chatting on whatsapp?
Answer: Firstly it'll check if the first user is online every 10 seconds.
If they are online it'll then check to see if the second user has been online for the next 10 minutes (also checking every 10 seconds for the second user).
If the second user is online within that time period, we've got a hit. ... 
Repeat.