Try closing/reopening the realm, and reopening Minecraft too. If the issue persists, you might try restarting your PC and see if this fixes the issue. If you have a firewall, antivirus software, or VPN, check the settings so that it's not blocking/slowing your connection. ^FF