RTCMultiConnection Demos cordva for IOS

528 Views Asked by At

We integrated RTCMultiConnection Demos cordva code in iOS app and also add iOS native code into it. need to confirm one thing that how it will be linked with our web code i.e if i will call from my IOS app then how it will get connected within my website . Please confirm if possible and how.

Thanks in Advance plus Happy New Year

1

There are 1 best solutions below

6
On

Your cordova app sets socketURL:

connection.socketURL = 'https://domain.com:9001/';

Your cordova app has a file named as loadRTCMultiConnection.js. This file MUST be using same RTCMultiConnection distribution as the your web page.

Conclusion:

  1. Your cordova app MUST set socketURL parameter
  2. Your cordova app MUST be using same RTCMultiConnection.js

Explanation:

socketURL is used to access your socket.io server. Both cordova app and web-browsers are using same socket.io server.


Updated at Jan 03, 2017

To use Firebase in the RTCMultiConnection-cordova-apps:

  1. Open index.html and replace socket.io.js with Firebase.js
  2. Add this script in the same index.html file: <script src="js/globals.js"></script>
  3. Add this script in the same HTML file: <script src="js/FirebaseConnection.js"></script>
  4. Opne index.js and add this line: connection.setCustomSocketHandler(FirebaseConnection);
  5. As well as this line: connection.firebase = 'webrtc-experiment';

To recap it:

<!-- index.html file -->
<script src="js/Firebase.js"></script>
<script src="js/globals.js"></script>
<script src="js/FirebaseConnection.js"></script>

and:

// index.js

var connection = new RTCMultiConnection();

connection.setCustomSocketHandler(FirebaseConnection);
connection.firebase = 'webrtc-experiment';

PS. You may need to modify config.xml to enable websocket or XHR_polling requests from firebase.com. Simply replace rtcmulticonnection.herokuapp.com with firebase.com. E.g.

<?xml version='1.0' encoding='utf-8'?>
<widget>
    <platform name="android">
        <allow-navigation href="https://firebase.com/*" />
        <allow-intent href="https://firebase.com/*" />
        <access origin="https://firebase.com" />
    </platform>
</widget>