Recommended WebRTC Server Configuration for Native app (iOS/Android)? - webrtc

I tried to build a server for integrating the webrtc native APIs in an native app, but I am not sure about how the server should be configured, like the ICE/STUN/TURN, signaling, media server etc..
So far as I know is the open source project: https://github.com/priologic/easyrtc
Can anybody give some recommendations?
Thanks

In a WebRTC infrastructure, there are several things involved. The client part is written in JavaScript and runs on the browser.
But as you said it is a server side part. First there is a ICE/STUN/TURN server that it's used for a client to discover its public IP address if it is located behind a NAT. Depending on your requirements could not be necessary to build/deploy your own server, but use an already public (and free) existing one - here's a list. You can also deploy an open source one like Stuntman.
Then it comes the signaling part, used by two clients to negotiate and start a webrtc session. There is no standard here and you have a few options.
You can use an XMPP server with a Jingle extension. You can deploy an existing XMPP server, like OpenFire or Tigase
You can also use SIP, a protocol much more encountered for VoIP. You can use JAIN-SIP or SIP Servlets.
Or you can develop your own signaling protocol using something like websockets.
The server side options that I was giving you were Java based ones, but you can find similar for other infrastructures too.

STUN/TURN is required. Use public ones (not absolutely stable) or get a Ubuntu machine ans install from the source: https://code.google.com/p/rfc5766-turn-server/
Signaling is trivial. You just forward messages between peers. Just build a simple chat server.
Media server is whole different story and require sophisticated client-server configuration.

Related

Server as WebRTC data channel peer

Are there currently solutions where your server can act as the peer of a WebRTC connection?
The reason I am interested in WebRTC is not the peer-to-peer part of it, but because it enables you to use UDP. You could let players participate in a fast-paced game like Quake without needing any plugins.
It seems that essentially this same question was asked before, but surely things must now be quite different as 2 years have passed.
Yes, it is possible to deploy your WebRTC peer code on server. But since you need to run it on server, it's essentially different from how you run the WebRTC code within the browser - i.e. through a Java Script.
For server based WebRTC peer, you would need to use the WebRTC native code available on platforms - Windows, Mac OS X, Linux, Android and iOS. You can get the WebRTC native code from - https://webrtc.org/native-code/development/
Follow the instructions here to download and build the environment. Sample applications are also present in the repository at the locations - src/webrtc/examples and src/talk/examples
In summary you have use the WebRTC source code that is embedded in the browser in your application code and call the relevant methods / API for the WebRTC functionality.
I have answered similar question at: WebRTC Data Channel server to clients UDP communication. Is it currently possible?
We have implemented the exact same thing: a server/client way of using WebRTC. Besides we also implemented data port multiplexing, so that server would only need to expose one data port for all rtcdata channels.
Here is 2018 update for you: your off-the-shelf solutions are:
Red 5 Pro, Wowza, Kurento, Unreal Media Server, Flashphoner
Also note that in modern public networks TCP is not much slower than UDP;
but UDP may have a considerable packet loss, so try WebRTC-TCP for your Quake idea.

Receive and send sip in two applications at the same time

I have a softphone X-lite installed on my computer. i wanted to develop a program in C # to see the sip messages it receives and sends. already built a softphone that does this. but I want it in a standalone application. I'm in trouble because I can not use the same port for two aplications ... someone can help me?
Sorry for my bad English...
Try using pjsip
it is open source tool. Try and run the pjsua application. It will let you make/receive calls from any port of you choice. It will act as a UAS/UAC. You can also register your X-lite client at this port.
E.g. pjsua --local-port=5090
Detailed usage of pjsua

Choosing between network (Ethernet or WiFi) programmatically

On my mac I have two kinds of networks available - Ethernet, WiFi.
While making a server call, can I somehow control which network channel to use for making the server call? So, before making server call, I want to specify the network channel to be used for that call - Ethernet or WiFi.
How can this be achieved using objective C. I am working on a cocoa application.
I assume both NIC's are connected to Internet (so both have a IP):
I don't think you can solve it within code (not 100% sure). But what you could do is setup some local routes, configuring which traffic goes over what NIC.
Look at the route command ('man route').
This might help you:
https://serverfault.com/questions/100613/public-traffic-to-go-over-1-nic-and-private-traffic-to-use-another-nic
You can modify the routes available with the System Configuration framework. In scutil(8) you can see the routes that are presently installed in the State:/Network/Service/* dictionaries, and in order to manipulate these programmatically you have to us the SCDynamicStore framework, which is C.
However, if you were trying to just do some ad-hoc service on WLAN only, you could use the CoreWLAN framework, which is in Objective-C.

Setting up a server at home for Android app

I'm currently developing a simple multiplayer game app for Android and I need to have a server to which the users connect to.I'd like to set up this server at home. I have a dynamic IP address,so someone told me I'd have to set up a local DNS server or something like that. I'm not even sure where to start with setting up a DNS server, everything I found was for windows 2003 and linux. Nothing for XP? If any one can shed some light on this matter, explain a bit how setting a DNS works or supply a link with "setting up local DNS for dummies" I'd be grateful.
Also, besides setting up a DNS so I can find the server every time, how about the communication with it? I'd like for it to be as secure as possible. Another friend told me something about communicating via SSH, which is again something I am not accustomed to.
So if someone could explain some of these concepts or offer some GOOD link for that that would be great. I'm very confused :)
Thanks
EDIT
Btw, the server is in Java and currently i'm communicating from Android emulator to the server (which is localhost) via sockets.
That's not a simple thing you're trying to achive. First you have to create your own server on your machine (maybe you're done with this step), then you have to make this server available for everyone. At this point, I suggest the DynDNS service:
http://lifehacker.com/124804/geek-to-live--how-to-assign-a-domain-name-to-your-home-web-server
A local DNS by default help you to find your own servers by name instead of IP address, but if you have a usual internet service with dynamic IP, you need an external DNS provider to route your clients to your server. (read the link above for the full explanation)
About the SSH security: Yes, you will need some security settings indeed, but that could be a very hard problem sometimes. You can set your server to work with SSL sockets, which is a part of the core J2SE release. It will work against some sort of attack, but none against others. Running your own server will raise unexpected numbers of problems, prepare for that.
As already stated in the comment to your post, something like http://www.no-ip.com or http://www.dnsdynamic.org would solve the issue with your dynamic ip - You do not need a local DNS server.
With regards to communication, i believe that SSH is linux/unix only. Since you wish to use Windows for the server, FTP or Remote Desktop would be best. Choose FTP if all you want to do is manage your files, choose remote desktop if you wish to manage your entire computer. I've had good results with the FileZilla FTP server on windows (http://filezilla-project.org/)
With that said, i think you would be better off buying a simple and cheap hosted service instead of using your own computer - you can get something that can run your java app for $5/month some places, and compared with the annoyance of having a local server running in your house, it might be worth it.

How to implement websockets on an embedded device server?

I am working with an electronics appliance manufacturer to embed LAN based control systems into the products. The idea is to serve up a system configuration/control interface through a web browser so clients never need to install software. We can communicate with the appliance by sending and receiving serial data through the embedded module. Since the appliance can also be controlled from a front panel UI, it creates a challenge to keep a remote web interface in sync with very low latency. It seems like websockets or some sort of Push is what we need for handling real time events from the server to clients.
I am using a Lantronix Mathport AR embedded device server. Out of the box the unit will serve up any custom HTML and java servlets/applets. We have the option to install a lightweight Linux distro if we need more flexibility. I am not sure how to implement any server side apps since the device is not running standard Apache. I believe it is using Boa.
Can anyone guide me in the right direction of how to do this?
Some general info...The WebSocket protocol (draft spec here) is a simple layer on top of TCP. What this means is that, if you already have a TCP server for your platform, implementing the WebSocket is just a matter of hours. The protocol specifies a handshake and two ways of sending data frames.
I strongly suggest you start by reading the 39 pages spec.
As Tihauan already mentioned, start by reading the spec, and also note that there are still some changes ongoing, although websockets is now more stable than it was 1 year ago.
Key point for me was the requirement that websocket data is entirely UTF-8 text, which lends itself nicely to JSON based message definitions.
Our system uses a form of embedded linux, so we then added and made use of the following libraries:
"libwebsockets" from:
http://git.warmcat.com/cgi-bin/cgit/libwebsockets/
"jansson" from:
http://www.digip.org/jansson/
Using the above as support libraries, we created an internal lightweight "client/server" that allowed our other software modules to register for certain, applicable, websocket messages, and respond as needed. Worked great.
Good luck and best regards,
I'm a bit late, but Mozilla posted a guide entitled "Writing WebSocket servers", which literally guides you through writing a websocket server.
You will need to already know how HTTP works and have medium programming experience. Depending on language support, knowledge of TCP sockets may be required. The scope of this guide is to present the minimum knowledge you need to write a WebSocket server.
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers