Closed jimmywarting closed 2 years ago
Hey @jimmywarting, sorry for the delay.
Yes you can store them! This was cited as a use case in webrtc-pc
The last issue is that a RTCPeerConnection listens on a random port. A good solution to that could be birthday problem. I don't know how many attempts we get, but that could be a good first step.
Talking over GitHub issues is hard (since Pion has so many). If you want to chat I am available on Slack and find this super interesting!
Did you get this working?
I never did anything with RTCPeerConnection.generateCertificate
...
I would like to know how you could make use of it...
eg if it's possible to establish a p2p connection without signaling (if it's at all possible - i don't know)
My use case is communication between different parts of the same browser and same machine. One would think something could be hardcoded. During experiments I found icecandidate
event does not fire when offline. The closest I got was using an extension ServiceWorker
and offscreen document for signaling for the ability to stream data to arbitrarary tabs https://github.com/guest271314/offscreen-webrtc. Reading this https://stackoverflow.com/a/29418087 it appears a lot has to be in order. Then we have this repository...
First of all, I believe this approach can only work on local networks (i.e. you can't connect machines over the Internet), because it relies on mDNS, which, AFAIK, doesn't work on the Internet. Secondly, you probably can't connect two browsers on separate machines on a local network without hard-coding an IP address of at least one of them. This is because
My use case is communication between different parts of the same browser and same machine
For the case when the peers are on the same machine, the knowing the IP/mDNS is not a requirement, since each peer knows the the other peer has the same IP, but there is still the problem of ports.
To communicate just between browser tabs, I'd also consider localStorage
, cookies, postMessage
, BroadcastChannel
.
I'm not trying to just communicate between tabs. I can do that here https://github.com/guest271314/offscreen-webrtc and here https://github.com/guest271314/sw-transfer-stream, and the approach descrined here https://github.com/guest271314/requestNativeScripts.
What I noticed when testing the former is that WebRTC does not work offline.
My use case is using libdatachannel offline on the same machine from browser to local application.
I just discovered that there is a way to generate certificates that you can generate in the browser using RTCPeerConnection.generateCertificate
it's also possible to store this cert in indexedDB. and construct a peer connection using
new RTCPeerConnection({certificates})
i have no understanding of why you would want to create your own certificates and store it in the indexedDB... haven't find any article/demo of someone who are using it of how and why you want to use own certificates
is it so you could create some kind of “reusable offer/answer”?