Ah, Cloud Messaging. What fun. I have gotten this to work in React Native on Android, and I thought well gee, I should use this in the web version too! But it doesn’t work in IE, and even in Chrome it only works over https (which I don’t have in my development environment), and you need a service worker, blah blah blah. This is starting to sound like a pain in the ass.
So then I thought OK, what do I do when I can’t do cloud messaging? Web sockets? Polling? Polling seems horrifyingly primitive, but it’s super simple, and it will always work if the server is working at all. So I’m going to need it as a fallback anyway in case whatever web socket garbage I’m going to need isn’t available. I’m not totally convinced that web sockets are more efficient anyway. I mean I’m supposed to have a socket connection open to every single person using the web app? At least with polling, not everyone is connected at once, and I can tell them to poll less frequently if things are getting out of hand. I could exert some control over how many web sockets I have too, by kicking out the idle ones as new ones come in… but then all the disconnected web sockets are going to be knocking on the door again when they become active, and it starts to look a lot like polling! So I may as well just do it.