I have a galaxy s5 phone running on android 5.0. In home and in office, when I'm connected to wifi network and the screen is locked (sleep), whatsaap doesn't receive any message until I unlock the screen. I don't use so many apps so I can't confirm if this is the case with other applications or not, however, I might have experienced the same problem with email app as well.
Keep Wi-Fi on during sleep is set to
Always, I don't have any power management application or any particular settings. I checked Whatsapp faq and they suggested checking priority notification, which I don't use. Searching the web suggests clearing cache and data which doesn't solve the problem.
I have observed my phone behavior and noted that other applications (e.g., hangouts) show act the same. Furthermore, I noted another fact that might shed some light: Say I unlock my screen and after several seconds my apps start to notify me about some messages. But time-stamp of these messages aren't for this moment but rather [e.g.] half an hour ago when they were suppose to be delivered.
I have cleared the cache/datafiles, updated the app etc. I would highly applicate if you submit answers that do not suggest these generic (and almost always non functional) workarounds. Thanks.