As I mentioned in the sibling, there's multicast/broadcast (classic multiplayer games used it) and you could do IP scanning.
The standards are carefully defined in a way that creates server dependency. WebSocket outright does not allow connections to other browsers directly. WebRTC does, but you are extremely limited in how you could do discovery. I think both are intentional.