Catch errors on connect
How best to check if Normcore is available, or if Normcore ports are blocked, and catch these problems so I can code for them.
2 Replies
Hi @DC. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To check if Normcore is available or if ports are blocked, and to catch these problems, you can follow these best practices:
1. Use try-catch blocks: Wrap your connection code in try-catch blocks to handle any exceptions that might occur during the connection process.
2. Check connection status: Monitor the connection status using the
Realtime.connected
property or the Realtime.didConnectToRoom
event.
3. Implement timeout logic: Set up a timeout mechanism to detect if the connection is taking too long.
4. Check firewall rules: Ensure that your network allows the required ports and IP ranges for Normcore.
Here's a more detailed breakdown:
1. Firewall Rules:
Make sure your network allows the following outbound traffic:
- TCP ports 443 and 3000 to *.normcore.io
- UDP ports 32,768 - 65,535 to any destination IP
Normcore Firewall Rules provides more details on the required firewall configurations.
2. Connection Error Handling:
When connecting to a room, use try-catch blocks to handle potential exceptions:
3. Connection Status Monitoring:
You can check the connection status using the Realtime.connected
property or by subscribing to the Realtime.didConnectToRoom
event:
4. Implement Timeout Logic:
Set up a coroutine to implement a connection timeout:
By implementing these strategies, you can effectively detect and handle connection issues with Normcore, including port blocking and availability problems.
If you're still experiencing issues after implementing these solutions, you may want to check your logs for specific error messages. The Platforms Common Questions section in the Normcore documentation provides additional troubleshooting steps for specific scenarios.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1259730396577529917> Kapa.ai is still learning and improving, please let me know how I did by reacting below.