Replies: 2 comments 5 replies
-
First of, what is the reason you use ws inside load functions? |
Beta Was this translation helpful? Give feedback.
1 reply
-
There are various hooks, you probably could use either
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently found this problem where I create a ws client instance in a
+layout.ts
file.The ws client sends a ping every 60s via a
setInterval
.I would like to stop pinging and destroy the client when the user navigates outside the corresponding layout but since the client is being held by the
setInterval
closure, it is not destroyed. There is also no way to clear the interval.Is there a clean way to do this other than setting the ping interval in the
+layout.svelte
file and destroying the client and the interval there? I don't really want to resort to passing "useless" props to my layouts just because I cannot clean them up in a+layout.ts
file.Beta Was this translation helpful? Give feedback.
All reactions