NeoLegends / velocity-pwa

🚴‍♂️💨 An alternative https://velocity-aachen.de/menu
3 stars 3 forks source link

Consider Websockets for updating stations #29

Closed Empty2k12 closed 4 years ago

Empty2k12 commented 5 years ago

Polling every minute is very inefficient and slow.

Consider using one of the available Websocket data sources for transparent updates in near-realtime.

NeoLegends commented 5 years ago

PRs welcome 😄

NeoLegends commented 5 years ago

Alternatively we can consider changing the poll interval to 20s.

Empty2k12 commented 5 years ago

Alternatively we can consider changing the poll interval to 20s.

Don't do it

NeoLegends commented 5 years ago

Wenn ihr SSE einbaut mache ich das vllt wirklich.

Empty2k12 commented 5 years ago

Can you access SSE on a domain that your frontend is not hosted on?

NeoLegends commented 5 years ago

Not sure, but proper CORS headers will resolve that.

NeoLegends commented 5 years ago

Not sure though about adding a dependency to your servers. How's your uptime been?

Empty2k12 commented 5 years ago

Access-Control-Allow-Origin: *will be regeling!

NeoLegends commented 5 years ago

This will actually require a large(ish) refactor of the hooks code, because currently it's all based on wrapping the official REST API and polling periodically.

Empty2k12 commented 5 years ago

That's why we're using Redux for state management and time-traveling debugging. But I can see why you chose a different solution based on your requirements. Not sure how to best adapt/combine both..

NeoLegends commented 5 years ago

Well, at least the data fetching would need to be changed. This would be possible and the hook surface wouldn't need to change much (if at all). Redux wouldn't really provide an advantage here. (In redux you'd change your data layer that would be made with saga or thunk or something)