Triggering a page reload from a server #11733
-
Hi! I do something weird - a desktop app in Svelte with tauri. So the client and server live on a same machine and have a single user. My app has a POST endpoint and when it receives a request, it changes the app state on the server. How to notify client of this ChatGPT suggests to poll server from a client every second, if state has changed, do Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Well, since you are using tauri you should use a builtin mechanism for this kind of stuff. In this case you can use events: https://tauri.app/v1/guides/features/events Emit an event from the server and listen for that on the client. In the callback you should call invalidateAll, which is the correct way to trigger a rerun of all load functions. |
Beta Was this translation helpful? Give feedback.
Well, since you are using tauri you should use a builtin mechanism for this kind of stuff. In this case you can use events: https://tauri.app/v1/guides/features/events
Emit an event from the server and listen for that on the client. In the callback you should call invalidateAll, which is the correct way to trigger a rerun of all load functions.