i am developing a social network with a chat messenger. it's a responsive web application. the messages are saved on mongo db, and then sent instantly through socket io. the problem is when computer is sleeping/mobile is locked, the socket io connection goes off. and when coming back from sleep/lock mode, the connection doesn't re-create. let's say a user got couple of messages when his phone was locked, and the webpage was open there waiting for him. even if i re-connect the socket when user starts interacting with webpage again, still the user will not see the instant messages he was getting, because the messages from mongo arrive only when entering the app for the first time.
the only solution i can think about is that when coming back from sleep, the web page should reset itself and loads again with all the data from mongo db.
do you have any better idea? is auto refreshing after detecting waking up from sleep mode, is even possible?