I need to create a cross-platform peer-to-peer application (at least iOS and Android support). For this, I use Cordoba. Currently, I can perform service discovery using the ZeroConf plugin. Now I would like to make a peer-to-peer connection upon discovery.
An equivalent application has already been created using Titanium. Once detected, it uses sockets to connect to the detected machine.
/*
Service Discovery resulting in an IP address and port number
...
*/
socket = Titanium.Network.createTCPSocket({
hostName: discoveredHostName,
port: discoveredPort,
mode: Titanium.Network.READ_WRITE_MODE
});
...
socket.connect();
However, I need to transfer the application to Cordoba, so I need an alternative to the sockets that are used in the Titanium version. Using an intermediate server is not an option (it can only be used for signaling, and not for messaging).
My mentor advised using webRTC as it is a simple standard Javascript API mentioning that it runs on iOS, citing the official website that supports iOS . I implemented it by testing it in a browser and it works like a charm.
However, when testing on iOS webRTC does not work :
var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection || window.msRTCPeerConnection;
, iOS , RTCPeerConnection undefined. , - , iOS?