I've got a fairly simple chat service up using Rails 5 and ActionCable. It allows the user to select 1 of a handful of rooms and it all works great and was super fun to setup.
The next issue I want to tackle is using geolocation to only display messages that are within X miles. I've got latitude and longitude in the Message model and I'm aware of geokit and geocoder so I know I can find messages within a certain distance to the user. What I'm having trouble conceptualizing is using this in conjunction with ActionCable. The idea sounded so easy in my head but when it came time to implement, I can't think of how to pull it off elegantly. Do I just allow all room messages through and filter them through JavaScript on the client? That seems kind of hacky and a waste of bandwidth for a bunch of messages being to the client without ever reaching the interface. Sadly, this is the only method I've been able to think of.