fix: Allow Relay hosts/servers on WebGL #2321
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The check in place cast too wide a net, which resulted in an exception being thrown if starting a host on WebGL even if using the Relay service, which is a valid use case. What we want to prevent is trying to start a host/server on WebGL builds when using direct IP connections, because browsers can't act as servers. But when using Relay, the browser is not acting as a server, it's always acting as a client to the Relay server.
This PR addresses that by only throwing the exception when not using Relay.
Changelog
UnityTransport
where an exception would be thrown if starting a Relay host/server on WebGL. This exception should only be thrown if using direct connections (where WebGL can't act as a host/server).Testing and Documentation