Socket.io vs xmpp for a mobile chat app - ios

I have to build a realtime chat app in iOS, which can later also have voice and video calling. I want to use a scalable and light weight solution integrated with the backend, making sure that the solution also supports calling in the future.
I'm not too sure if socket.io supports voice and video calls; Should I use that or xmpp? Or any other similar solution?

As it was written above socket.io is a chat server implementation using Websockets, while XMPP is a protocol.
I'd recommend using an XMPP chat server in this case.
For audio/video calls implementation you will need to implement signaling via XMPP to establish connection between the devices before the call.
Also for audio/video chat implementation you will need STUN/TURN/ICE server and you will need to add client-side implementation for passing media streams from peer-to-peer if you choose WebRTC peer-to-peer option.
There is an easier way as well. You can use a ready XMPP based server and SDK to build your app. For example, ConnectyCube provides such service.
They have a ready backend and SDKs you can use for building chat and audio/video chat apps. Also they already have a TURN server, so you do not need to worry about this part too.

Related

Is CallKit Sufficient

I am new to ios development. I am trying to build a voip app and I was wondering, is callkit all I need? or I need to integrate it with an already built voip app, using for example WebRTC?
As you might have guessed, CallKit alone is not sufficient.
CallKit only provides the system-calling UI, and you need to develop the backend system for yourself. (Of course, you can use Web RTC instead of VoIP.)
Use CallKit to integrate your calling services with other call-related apps on the system. CallKit provides the calling interface, and you handle the back-end communication with your VoIP service.
https://developer.apple.com/documentation/callkit

iOS XMPP vs WebRTC, which should I use?

I want to build an iOS application that people can video call or audio call to each other. Stable calling is my goal, and it means I need less connection interrupt as much as good, I also need light application (not too high application size because of video libraries)
I've googled about "ios video chat' keywords since last few days. Researched and found that the most popular framework (technology, library) for video/audio calling are XMPP and WebRTC (I'm I right or do guys have something better?)
XMPP - Client/server TCP communication
WebRTC - P2P Connection
The information about these libraries make me confused, so which library I should use for better performance, light application, stable?
Any idea?
XMPP is about signaling (reaching from A to B, indicating the desire to have a "call", disconnecting, etc).
WebRTC is about media (actually sending voice and video).
You need both signaling and media in your app.
For media use WebRTC. There's nothing else that will make sense. On iOS, it is kind of tricky at the moment, as iOS 11 incorporates WebRTC already, so how this will apply and help you in your development is yet to be seen (see here).
My suggestion is to aim for a web app and then figure out if you need to go for a fully native implementation and port WebRTC to iOS - or just use a webview inside an app (Cordova or Crosswalk should do).
For signaling, you can use XMPP. Or anything else for that matter. My own personal preference is a proprietary protocol. Look at Matrix or SimpleWebRTC for that.
Also - don't forget that you will need to deal with STUN and TURN - NAT traversal, but that's a simpler thing to handle.
XMPP Framework: https://github.com/robbiehanson/XMPPFramework/wiki/IntroToFramework
WebRTC Native Code: https://webrtc.org/native-code/ios/
its not about which is best its about what fulfills our requirements

Integrating PubNub WebRTC SDK for iOS

I Am stuck with integrating the PubNub WebRTC SDK for iOS application.
Its a JavaScript SDK. How To integrate this with my iOS app.
Thanks in advance.....
This does not directly answer the Objective-C implementation, but it might help with understanding the overall solution and the role that PubNub plays.
Why PubNub? - Signaling
WebRTC is not a standalone API, it needs a signaling service to coordinate communication. Metadata needs to be sent between callers before a connection can be established. This metadata includes information such as:
Session control messages to open and close connections
Error messages
Codecs/Codec settings, bandwidth and media types
Keys to establish a secure connection
Network data such as host IP and port
Once signaling has taken place, video/audio/data is streamed directly between clients, using WebRTC’s PeerConnection API. This peer-to-peer direct connection allows you to stream high-bandwidth robust data, such as video. HTML5Rocks provides a great guide on all things WebRTC (no need to read as it is summarize below).
PubNub makes this signaling incredibly simple, and in addition, gives you the power to do so much more with your WebRTC applications.
What PubNub is Not
PubNub is not a server for WebRTC. A signaling service specifies ICE servers that the video chat can stream over. Public STUN servers provided by google can be used, but they are not very reliable. STUN or TURN servers are required to circumnavigate a firewall, else chat will fail. Many services provide the “total package” of signaling and server in one, that is not PN. Our audience are the people who want to build their own, more custom service.
XirSys
XirSys already have a WebRTC-PubNub demo using rails on their GitHub. They host STUN and TURN servers catering to the needs of WebRTC.
Open Source
There are a few open source STUN and TURN server projects that can be downloaded and hosted with ease:
Amazon AWS VM: Pre-made ready to deploy
RFC5766 TURN: Google Code, TURN server
One-to-many: Instructions on MCU for 1-to-many media servers. Necessary for large group chats and streams with hundreds+ users.
So as you can see, we do not provide audio/video streaming services but if you are building this solution, PubNub is a necessary piece to tie it all together with the signal protocol.
AndroidRTC
And here is an PubNub AndroidRTC example by our interns.

WebRTC for iOS for VoIP communication

Is there any WebRTC solution for iOS for free with easy setup?
I tried to use http://www.webrtc.org/native-code/ios because our web end is already done with its web api and I thought I may not have other way around for letting calls go between web and iOS too. But iOS API's setup is very tedious and time taking (The downloading of WebRTC checkout is taking like lives with no gain).
I searched around and found a few like tokBox and quickblox but they are not free.
Did you look at RestComm iOS SDK ? It supports WebRTC Audio only right now but we are working on adding video in the next few weeks. Also it uses SIP as a signalling protocol.
https://github.com/Mobicents/restcomm-ios-sdk
http://www.telestax.com/how-to-integrate-the-restcomm-ios-client-sdk-in-your-app/
http://docs.telestax.com/restcomm-client-ios-sdk-quick-start/
Take a look at https://github.com/oney/RCTWebRTCDemo .
This is a React Native WebRTC project which works on iOS and Android and also has a signaling server example (but you can also use the online version for quick tests!).
Since the WebRTC requires DTLS-RTP, RTCP-FB, ICE and a lot of other newest standards, but the VoIP standards are old about 10+ years, therefore you need setup a gateway to convert the signaling and transcoding the RTP.
With the WebRTC Gateway, in the browser side, you can create the HTML5 application to connect to WebRTC gateway, the gateway will communicates with your PBX, and your iOS client connects to your PBX, then the call can be established between browser with iOS client app.

Working with WebRTC on IOS

I am happy that I got Video Chat working with WebRTC on iOS by following the tutorial here:
http://ninjanetic.com/how-to-get-started-with-webrtc-and-ios-without-wasting-10-hours-of-your-life/
But, I am not able to understand how is it Peer to Peer Video Chat when I am connecting to the appspot server (Google App Engine using Channel). Is it possible to remove this appspot. I have my own client verification system. So, I am pretty sure to maintain the proper authentication of who is going to connect to whom.
The GAE channel is used for signaling. Signaling is not part of webrtc and you can use any signaling method you like.
"Exchange of information via signaling must have completed successfully
before peer-to-peer streaming can begin"
You can find more information here and here

Resources