Zemke / react-native-peerjs

PeerJS for React Native
56 stars 36 forks source link

Peerjs never establishes connection with secure broker server on iOS with react-native-peerjs and react-native-webrtc #19

Open goguda opened 3 years ago

goguda commented 3 years ago

I have this setup working flawlessly in my web app and with react native on Android using the setup described in the title, but on iOS the peer never seems to establish a connection with a secure PeerJS server. It works fine on iOS as well if SSL is disabled on the server and secure is set to false, but ultimately this is not what I want.

This is my code

this.peer = new Peer(peerId, {
                          host: 'myvideobroker.url.com',
                          secure: true,
                          config: {
                            iceServers: TWILIO_ICE_SERVERS,
                          },
                          port: 443,
                          debug: 3
                  });

This is the only output I've been able to get from XCode/RN:

2021-02-13 19:10:33.501919-0500 [10333:2778905] [native] SocketRocket: In debug mode.  Allowing connection to any root cert
2021-02-13 19:10:34.939491-0500 [10333:2779134] [javascript] 'PeerJS: ', 'Socket closed.', { isTrusted: false, message: [Getter/Setter] }
2021-02-13 19:10:34.940881-0500 [10333:2779134] [javascript] 'ERROR', 'PeerJS: ', 'Error:', 'Lost connection to server.'
2021-02-13 19:10:34.952775-0500 [10333:2779134] [javascript] 'PeerJS: ', 'Disconnect peer with ID:009b1bf9-6901-4237-a1a5-3e64fa14d249'

Ultimately it seems to be a problem with the way iOS is handling SSL here. The weird thing is the web app works flawlessly from Safari too, it's just RN and iOS. I've checked the logs on my host and there is nothing, like a connection is never even established (or tried to be established). Any ideas?