Reputation: 263
Here is client side code: http://hostcode.sourceforge.net/view/2911
Here is server side code: http://hostcode.sourceforge.net/view/2912
So what happens is, I have two buttons. I am new to webrtc, so I am just testing this out with buttons for now.
I open one window and go to localhost. I click accept camera, and see myself in the camera. Then, on the first window, I am supposed to click on connect. I don't click on the other button!
I open another window and go to localhost. I click accept camera, see myself, and then I click first on connect, and THEN on create offer button. These two windows get connected, BUT it generates like 8-15 ice candidates... And I have them logging on the console. So many ice candidates.... why? Is it a list of all the people on my wifi network? Or what? Where it says "Ok so this is ice candidate event, I guess:" and then it lists the ice candidate.... It writes that like 14 times in console.log, just when those two windows connect! It doesn't make any sense...
Upvotes: 1
Views: 2314
Reputation: 522005
I thought ice candidates were people who have opened a window
Nope, that's where you're wrong. The ICE protocol is trying to establish a direct network connection between the two peers. This is a hard problem. There are many problems in regular networking topology to work around and many possible routes a direct connection could take. The ICE protocol uses a third party server (as in, somebody other than the two clients you're trying to connect) to probe possible network paths between both peers. That's what ICE candidates are. They're one suggestion how a connection may be established. The three parties keep probing and testing different possibilities until all are exhausted and/or a good direct connection has been established.
Upvotes: 3