I’m trying to setup communication between two browser windows based on WebSockets and WebRTCStar transports. I’ve come pretty far using the docs and provided examples, but I got stuck with the error that “protocol selection failed” when I try to dial the listener. Does someone have a solution / pointers on how to solve this? My code can be found here: https://github.com/identity-box/hyperpath. It includes instructions on how to run the demo, which reproduces this error.
I found the problem. I wasn’t using SecIO because I’m tinkering and learning how this works, so no encryption seemed like a good idea at this point. Turns out the stack doesn’t work without it. SecIO is required to make it work.
It looks like you are using libp2p 0.27, so you can leverage the plaintext2 protocol for local testing instead of secio. This will still allow you to exchange public keys but it won’t encrypt anything.
But it seems like using SECIO over HTTPS/WSS or pure TLS is overkill. There should be the way to make this a part of safe scenario, with some configuration and special multiadresses maybe.
Unfortunately, we can’t rely on the encryption from HTTPS/WSS in browsers as we don’t use the CA system. Ideally, we’d be able to form an HTTPS connection then sign the some fingerprint from the handshake to authenticate, but browsers don’t expose that information.
Almost forget! In Node.js you can specify your own TLS CA what gives you an ability to control everything. So it could we worked out and the only case now is browser environments.