Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PeerConnection based on local IP's

Tags:

webrtc

What I want is, basically, to create a connection between two different computers on same local network. But i want to do this by computers' local IP's. (like 192.168.2.23 etc)

This must be a totally local connection. no TURN or STUN Servers. I am not sure if this is possible. Because there are not much documentation/example/information about WebRTC.

So, how can I create a connection from my computer to another one just passing its local IP as parameter?

Update: To be more clear; imagine there is an html page contains some code that activates my camera and audio services. and another -almost same- page is open in other computer. Waiting a connection request... And there is a textbox in my page to type an IP belongs to other computer on my local network. type 192.168.2.xx and bingo! i have connection between me and other computer.

I want this process as IP based, because there may be more than 2 devices on the network. And all of them are possible devices to create connection. So i need to reach them by their IP's.

Any example code or explanation would be great! even if it tells that this is not possible.

Thanks

like image 351
alioguzhan Avatar asked Nov 29 '13 01:11

alioguzhan


1 Answers

Peer discovery is a vital part in any WebRTC application. It's an expensive term for saying: "Hi, I'm computer 4 and I want to talk to you!". See it as calling a friend over the phone. You need to dial his number first. This part is not defined in the WebRTC standards. You need to implement this logic in your application. Once you know who you want to call, you need a way of exchanging vital information. This is called signaling, like flo850 put in his answer. Signaling is needed before any peer-to-peer connection can be set up.

To come up with an idea for your use case of 7 devices in a LAN.

If you have these devices connected to for example a WebSockets server and are in the same channel.

The WebSockets server can be written to route messages to specific receivers. Devices connected to the channel often are identified with some kind of ID, imagine you use the device's IP. When you want to talk to computer 4 with IP 192.168.0.4 you send the exchange messages (signaling) on the channel to the receiver with ID, the IP of the device you want to connect with. How to send the signaling (offer, answer) is described here with example code.

Hope this helps

like image 72
Gnagy Avatar answered Sep 23 '22 05:09

Gnagy