Video call on Unity with WebRTC without server - unity3d

I'd like to make a video call app using WebRTC on Unity. I have investigated almost of the WebRTC services and found out that the WebRTC services require "my own server" for authentication(to give users privileges to access the server). Some companies even say "no server needed" but I actually had to register my server domain to use their services - sounds weird...
my questions are :
why do we need to prepare server (It seems the service provider could have prepared auth servers as well)
Is there any WebRTC service as a complete sever bundle(really woking with client-side app only)
Thanks.

For webrtc you need at at least to exchange the candidate between the peer to allow them to connect (it's called signaling int the webrtc architechture), you also need server to handle network path if nat doesn't allow it (stun/turn server).
There is a lot of server and client depending on your use case complexity and stack. (kurento, Freeswitch, peerJs server ... )

Related

How to setup server for SMS communication for Teltonika FMB920

I am tring to create a vehicle tracking system based on GPS & GMS using Teltonika FMB920 tracking device. I am a bit confused on following things:
How to setup the server for communicating with the device.
How to save the data sent from the device on the server.
Can I use any cloud platform like Azure or AWS IoT features for this purpose.
Any guidance in this regard will be really helpful for me.
How to setup the server for communicating with the device.
Teltonika fmbxxx typically send data using websockets TCP or UDP protocol. To setup the server correctly, the port that will be listening for data needs to be opened in the server and the server address and port need to be configured on the device with the teltonika configurator tool
how to update server settings in configurator tool
How to save the data sent from the device on the server.
This depends on your use case but a good idea could be to use nosql database to save the data from device received by the server since its easier to scale when data size grows and easy to query and read the data
Can I use any cloud platform like Azure or AWS IoT features for this purpose.
AFAIK yes you can. essentially what is need is server instance with a websocket client application that can receive data from tcp/udp protocol

connecting a raspberry pi to a google home

I want to control my raspberry pi with my Google Home at college, but everything I find involves a server and opening a port which I can not do on my schools network.
Is there another way I can do this?
The Google Home has no way to directly control other devices on the same network or through other wireless protocols. Everything goes through an Internet-based service and expects to communicate with devices via a server-based proxy. How that server communicates with the device is up to the developer.
Depending on your needs and capabilities, you do have a few options.
One option, for example, is to use a tool like ngrok to create a tunnel between the device itself and a service run by ngrok on the public Internet. Calls to the public https address are sent to a service running locally on your device, and you can handle it accordingly.
Another is to have your device connect to a server and listen for command changes, and then execute those changes. If you don't want to run a server, you can even use something like Firebase - have your device listen for changes on the real-time database (which can use the HTTPS port to communicate as a client, so you don't open anything) and have something like a Firebase Cloud Function act as the webhook for your Action.
Go through this blog post: http://nilhcem.com/android-things/google-assistant-smart-home
You will have to set up a OAuth server but as #Prisoner said you can use ngrok to tunnel the device to internet, BUT I would recommend using "localtunnel" as it provides a free static url and the set-up is also easy. NO Port Forwarding is required with this method.
More info on localtunnel setup:-
How to generate fixed url with ngrok
Moreover you need to activate the OAuth server only once for account linking & than you can close it.
The simplest way I can think of is to expose your Pi to the internet (using port forwarding, ngrok, or whatever) then set up an IFTTT Google Assistant trigger to invoke a webhook which points to your exposed Pi.

Google Smart Home integration with my IoT device (clarification needed)

I am looking for some clarification to how Google Smart Home works.
I am looking to integrate my current end device which control lights with Google Smart Home.
My end device is running a very small microcontroller utilizing an RTOS (Linux is not available)
Here is how I see it (Please correct or comment)
To my understanding this requires me to host my own cloud service
which will talk to my current end device?
My cloud service will then talk to Google cloud service.
My cloud service defines the protocol to talk to multiple end devices
Google Smart Home define the protocol to talk to my cloud service
Questions
Is there any method of doing this without having my own cloud Service?
That is a pretty basic summary of things - yes.
The crucial point there is that issuing a command to the Google Home does not have it send out a message on your local network. Google issues any commands from their network - not from your device.
This might seem like a minor detail, but it doesn't need to be a "cloud service" that you control that Google talks to. It does need to be a publicly accessible HTTPS endpoint. This could be a cloud service (and it would be in most cases), a public non-cloud server, or even just a public URL that has a tunnel to your private network (such as with ngrok).
The last is really how you'd get around having your own cloud service - you can setup the control on a local machine, and have a tunnel using ngrok.
I think a specific example may be beneficial: here's how to connect Google Home to your devices using an intermediary service like IFTTT:
Create a recipe (applet) on IFTTT to connect Google Assistant to an ngrok tunnel using the Webhook service. This permits you to define a simple keyword phrase that the Google Home will recognize (like "Hey Google turn on my device"). The applet will then call a webhook - e.g. ngrok - with a custom command that you get to define (like "https://myngroktunnel.ngrok.io/Control.cgi?mydevice=on" ), where myngroktunnel is your ngrok tunnel address (see below #2) and Control.cgi is the CGI script that you have placed on your microcontroller (see below #3).
You would need to install and run ngrok on your microcontroller: this will connect the IFTTT applet to your microcontroller via the ngrok tunnel and give you a publicly-accessible URL that forwards requests to your microcontroller. You would typically forward your ngrok tunnel to a specific port on your microcontroller where you are running a web server (e.g. Apache) with CGI scripts to control your device. There are other secure tunnel services available on the web: ngrok is just one of them. So, you do not have to host your own webservice, but you do have to use a tunnel to a publicly-accessible service.
The web server that you have placed on your microcontroller has CGI scripts that control your device (for example, let's say you have a Control.cgi script that turns your device on or off, given a command string like mydevice=on, e.g. the hook in the IFTTT applet is "/Control.cgi?mycommand=on"
Of course, the RTOS on your microcontroller muse be capable of running ngrok and a web server - this is why many people have chosen to use a single-board computer like the Raspberry Pi or Orange Pi running a form of linux to host and control their devices. Since your device's RTOS is not linux, I would suggest getting a linux device which would then forward the request to your RTOS device over your LAN.

Is XMPP good choice for this solution?

I want to build communication solution for my project. Thinking about not to develop everything from scratch, but to use XMPP servers.
My project consist of many "mini-servers" (based on raspberry pi) scattered around different locations. Every mini-server should be reachable for mobile applications on its own network, this network could be isolated from internet. Every "mini-server" has to be autonomous and be able to live without internet, autethicate its own mobile client and respond to their requests. So mini-servers could be on private offline networks, could be on known static or unknown dynamic IP addresses behind firewalls.
Some mini-server users want theirs mini-servers to be reachable from the internet. So there is one more, let's call it cloud. This cloud would be responsible for routing request from mobile clients from the internet to their mini-servers.
My idea was to use XMPP server on every mini-server, my application would log in to this server on localhost and create chatroom. Every mobile client would connect to xmpp server and chat with my application request-response. When mini-server owner wants to connect to the interet to be reachable from outside, I would just reconfigure xmpp server to connect to my cloud XMPP cluster (on known public domain) and mobile app to connect to this public cloud server if not on private network. Every mini-server will have its own users, managed by other app on it. Mini-server has also log, this could be written for example to another chatroom. Mini-servers or mobile users does not want to talk to each other. It is pure mobile user to mini-server request-response realtime communication.
Can cloud-XMPP servers route request to mini-server xmpp server?
Is this possible with XMPP? Is it good use? Some better ideas?
What you describe looks like XMPP server-to-server federation, with some local Raspberry PI XMPP domains and some other XMPP servers on the internet.
So, I think yes, what you would like to achieve is doable with XMPP server.
A server like ejabberd works very well on Raspberry Pi.

What is the difference between service and server?

It seems that both service and server refer to some web based application. But is there any precise definition of the two terms?
A server offers one or more services. Server is also a more technical term, whereas service is more a term off the problem domain.
You also need to distinguish between:
Server as hardware (see post from Dan D)
Server as software (eg. Apache HTTP server)
You can find more elaborate definiton on Wikipedia:
Service
Server
This is regardless of client-server or P2P models.
A server provides services to one or more clients, and a server(hardware) is a computer. A server(hardware) can be anything from a home computer to a big server-rack with a lot of processor power.
From the view of a computer, a server(software) is just a set of services which is available to clients on the network.
Some well known services are web-server, mail-server. ftp-server. notice they are called xxx-server because such programs consist of a client and server part. The postfix is mainly to distinguish whether we are talking about the client or the server.
So at what moment do we call something a server? We do it when a computer shares some service/content on the network, which is accessible by clients. In other words, when we make a server as defined for software.
Regarding the P2P model: every one is both a client and a server, hence called servent. The above apply to the server part of a P2P network, just remember that it also can be a client.
Futher reading:
Client-Server model
P2P
a server is a piece of hardware or on a virtual machine
a service is a process that provides services normally over the network and runs on a server
but a server can also refer to a web server which is actual a service but it's sort of like one as it hosts services
i think those are reasonable working definitions
I think a simpler way to define both besides the definition of the server being a piece of hardware, a server in the software sense is a service that serves data. In other words you interact with a server with a request and you should get a response back. It "serves" data.
A service does not need interaction and is pretty much just a random process that keeps running doing the same thing, but a server is a service because it is basically a process that keep waiting for a request to come in so that it can return a response.
"A service is a component that performs operations in the background without a user interface."
~ Android Developers
Services don't just run on servers
Shell services
Services can run from the shell. Unix refers to services as Daemons (pronounced "demons"), and Windows refers to them as services.
Client-side services
Services can run client-side. Mozilla (and other browsers) support Web Workers which run in a background thread. Client-side frameworks, like Angular, support services as well.