oskar-gmerek / surreal-sveltekit

A Starter Kit with SurrealDB and Svelte [ SvelteKit ], featuring Authentication and CRUD Operations + Realtime
MIT License
60 stars 3 forks source link

websocket can't connect after run a few hours #9

Open tymon3568 opened 1 month ago

tymon3568 commented 1 month ago

i install Surrealdb with caprover, database work well. But after 4-5h, i can't connect to surrealdb wss. So my webapp get 500 errors, because websocket can't connect. I use webapp with cloudflare cache ( but when i set cloudflare in developement mode ( no cache), surrealdb still errors after some hours). When i restart surreal app in Caprover, it work again, and still connected. But after some hours, i can't connect using surrealist or webapp can't connect. When i don't use observeLive ( data.live() ) The surrealdb work well. So what happen? Does we use observeLive right? Or does we have to using in onMount like this:

onMount(async() => {
   await observeLive("watching_list", watchingList)
})

And have to close connect on

onDestroy(() => {
close data connection???....
})

How to fix this errors?