Is there a way to setup the server/client with a bigger timeout so it will not disconnect easily
This is for developent purposes - it is preferable we avoid such disconnections when we (for example) use breakpoints or pause the editor.
11 Replies
Hi @Niv. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, you can prevent automatic disconnections during development when using breakpoints or pausing the editor in Normcore. The
BumpAutoDisconnectTime()
method is available for this purpose.
When developing with Normcore, the server pings connected clients every five seconds to check their connection status. If a client doesn't respond (which happens when you're paused in a breakpoint), the server will disconnect them after about five seconds as mentioned in the Architecture > Common Questions documentation.
To prevent this during development, you can call the BumpAutoDisconnectTime()
method on the client. This method is available on the native client implementations as shown in the Reference > Classes > IClient, Client, and OfflineClient documentation.
You would need to call this method periodically to keep the connection alive during debugging sessions. You could set up a system that calls this method at regular intervals during development builds to prevent timeouts when you're paused in the editor.
Note that this is specifically for development purposes, and in production, the default timeout behavior helps ensure that crashed clients are properly cleaned up from the room.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@269927864265211906> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai - but when a breakpoint in code is hit, there's no way to periodically call BumpAutoDisconnectTime()
Let me check the knowledge base for you again. One moment! :books:
----------------------
You're absolutely right. When a breakpoint is hit, code execution is paused, so there's no way to periodically call
BumpAutoDisconnectTime()
during that pause.
For development scenarios where you're using breakpoints, there are a few alternative approaches you might consider:
1. You could temporarily use an offline mode for development and debugging. Normcore provides an OfflineClient
that doesn't require a connection to a server.
2. For debugging specific functionality, you might set up your debugging environment to run with a local room server if possible, which would give you more control over the timeout settings.
3. Another approach is to structure your debugging sessions to be aware of the timeout limitation - for example, by setting breakpoints strategically and resuming execution before the timeout occurs.
Unfortunately, the knowledge sources don't provide a direct solution for extending the server timeout specifically during breakpoint pauses. The fundamental issue is that when execution is paused at a breakpoint, no code can run to keep the connection alive.
If this is a significant issue for your development workflow, you might want to reach out to the Normcore community on their Discord for additional suggestions or workarounds that other developers might be using.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@269927864265211906> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
offline mode works like online mode 99% of the time except it connects immediately but otherwise it's a good way to test
I agree, but how would you get multiple players scenarios tested this way?
This has been an annoyance for me as well but I've made due mostly with log debugging, which in a lot of cases works better than breakpoints anyway, especially for VR development.
We’ve got a bug fix in the works for this. The server will time you out no matter what, but in an upcoming update pausing at a breakpoint will work and it will maintain your connection to the server
@fgamez1020 ☝️
💯