Currently, I have a project with public transport vehicles, I have to poll the GTFS-RT standard every x seconds and then I will receive the latest data for all vehicles. So to send this to the frontend I am using Redis Pub/Sub with WebSockets. Currently, however I just push all the vehicles to redis regardless of any changes. This causes the frontend to rerender everything, so it slows down the application. I want to actually just push whenever changes are made to the vehicles. Doing that however means that new listeners would miss out on vehicles. So I would have to persist the latest update for every vehicle.
Now here is my question, is this achievable by swapping out Redis Pub/Sub to Redis Streams and then just always deleting the current message if another message appears? if that is possible how would I do that? With Pub/Sub, I thought about just making a channel for every vehicle and letting the client listen to all the channels, as can be done with pattern matching, but it wouldn't solve the problem of the persistence, so what would be the best approach to tackle this problem?