I recently purchased a S21 Ultra and while I love the phone, suddenly Google Messages for Web kept losing connection to my phone. I would regularly have to unlock the phone and/or open the Google Messages app on my phone for it to reconnect. I have been using Google Messages for Web for years now with Samsung devices so I don't understand what the problem is (including a note 8, note 9, s20 ultra).
I've tried disabling "Optimize battery usage" for the Google Messages app as well as adding it to the "Never sleeping apps" list in Battery > Background usage limits settings screen but neither of those help.
I thought perhaps it was something wrong with Google Messages so I switched to PushBullet (which I used years ago successfully before Google released Messages for Web feature) but that app was having the same exact problem. Regardless of the battery usage optimization or app sleeping settings it would regularly lose connection to my phone until I unlocked the phone and/or opened the app on my phone.
This leads me to believe it is something with Android 11 or Samsung's One UI 3. Please help!
This would tell you if you have a Wi-Fi problem or a problem keeping the application running.
Have you tried updating your phone and apps to the latest version? What software version/carrier are you on? (Settings > About Phone > Software Settings > Build Number [last 4 characters]) If the problem still persists on data, and your phone and apps are one the latest versions you can submit an error report through the Samsung Members app and that should help you! Good luck