Skip to content

Hosting a lobby behind VPN causes join to hang silently when STUN discovery fails #224

@mentuat

Description

@mentuat

I’m encountering a problem when hosting a lobby from a user behind a VPN.
In this case, other players trying to network.join(lobbyCode) hang indefinitely — no connected event, no error, and no feedback to the app.

Debugging through chrome://webrtc-internals/, I observed:

  • Multiple icecandidateerror events occur (STUN discovery failures).
  • No usable ICE candidates (addIceCandidate) are generated.
  • As a result, the connection setup cannot proceed, and iceconnectionstatechange never fires.

Cause:

  • When the host cannot gather any usable ICE candidates (e.g., public IP discovery fails due to VPN blocking STUN), connection establishment is impossible.
  • Netlib doesn't appear to detect this failure case or emit any events to let the app know.

Impact:

  • Players joining a VPN-hosted lobby are stuck waiting forever, without any error or feedback.
  • The app cannot detect that the lobby is unreachable or retry automatically.

Suggestion:

  • Detect when ICE gathering results in no candidates (or ICE connection stays in 'new' state too long).
  • Emit an error event or a failed connection state after a timeout.
  • Additionally, consider allowing TURN server configuration for better support of VPN and NAT cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions