n8
n82y ago

Websocket closed error

Hey, ive seen this error occurring durring localdev when i step away from the machine for a while and come back.. I have also saw this while testing my project on an android device. Repo: open app to a page that was querying data. background app wait a bit open app. Is there a process I should be following when backgrounding? ie unsub / resubscribing ?
No description
10 Replies
sshader
sshader2y ago
I think we (Convex) are just being a little too noisy with console.error here. I think mobile devices are fairly aggressive with closing websocket connections whenever an app isn't actively in use, but Convex should in theory be smoothly re-making the connection when the app is opened again. Are you seeing any other issues aside from the console.error? (I can make this message quieter since it doesn't necessarily mean something's wrong)
n8
n8OP2y ago
well, ill need to test more. my app stopped updating at this point as well, i wasnt sure if its related tot he convex websocket or not.
basically i have a view that is requesting gps location. after 5 requests it posts it to the server via a mutation. would the websocket being closed prevvent the mutation from sending correctly?
sshader
sshader2y ago
would the websocket being closed prevvent the mutation from sending correctly?
Mutations should be sent as soon as the websocket reconnects (which in theory should happen once you re-open your app), but definitely possible that there's an issue here. (side note: actions wouldn't get sent over on reconnect in case that's relevant to your app) You could try new ConvexReactClient(address, { verbose: true }) which will print out a bunch of console logs about exactly when reconnects are happening and mutations are getting sent (would also love to see those logs and help debug if you'd be comfortable sharing).
whoami
whoami2y ago
I am getting the same error and when i refresh I still got WebSocket closed unexpectedly with code 1006, it happens to me multiple times on my local dev after walking away for a while, and the only way for solving it was to wait for a few minutes? Is there any smarter way for handling this? for the error I am facing right now, it didn't reconnect until now Firefox can’t establish a connection to the server at wss://clean-dinosaur-909.convex.cloud/api/0.14.0/sync. this happens to vercel environment as well...
whoami
whoami2y ago
on both firefox and chrome
No description
No description
alexcole
alexcole2y ago
For anyone else following along, we're discussing the same problem at https://discord.com/channels/1019350475847499849/1108758055677599795/1108772913114521740
presley
presley2y ago
Seems the issue in the other thread was different. @n8 let us know if the issue is simply seeing the error or the web socket is not reconnecting. @sshader has provided additional debugging step above.
Rakesh Roushan
Rakesh Roushan10mo ago
I am also facing the same error
Michal Srb
Michal Srb10mo ago
Hey @Rakesh Roushan please open a new support thread, and follow the instructions to include all relevant details.
Rakesh Roushan
Rakesh Roushan10mo ago
okay

Did you find this page helpful?