Are IceCandidate and SDP fixed values? Is this a good idea to store them in a server database instead of retrieving on every connection? If updating these data is unavoidable, when should I do it?
-
2They are created per connection as port and network information could change per connection – Benjamin Trent Apr 01 '15 at 13:15
-
It seems that on _server_, WebRTC doesn't scale well because of this serious limitation. No dream of connecting all your WebAssembly clients to a single high-performant UDP server. Just protocol limitation. Weird... – Brian Cannard Jun 13 '18 at 10:19
2 Answers
No they are not fixed values. Ice candidates locate the user in the network topology they reside in at present, which unless you have a static IP (which almost nobody has) AND a wired internet connection AND a static LAN address, AND a desktop computer that connects solely through these means and never also through, say, wifi, then this will likely change hourly, daily or weekly.
SDP additionally contains the media-setup for a call and other information, which can change from call to call, and even mid-call (requiring re-negotiation) if video or audio sources are added, removed or altered during the call. SDP may additionally contain other things that expire, but hopefully this is enough to dissuade you.

- 40,579
- 17
- 100
- 158
-
Do you mean that I can sometimes reuse them? Or in other words, they aren't temporary values? – Lewis Apr 02 '15 at 17:10
-
1Almost all of it is temporary information, because it is specific to *one call between two specific end-points*. Candidates contain port numbers, and you obviously can't have two simultaneous ongoing connections over them. An SDP answer is a unique response to a unique SDP offer, with IDs that have to match up. I don't see a lot of chance for reuse here. Connecting up two peers successfully is hard enough that I wouldn't risk using potentially outdated or mismatched information for the end-points. – jib Apr 02 '15 at 18:17
-
I'm thinking about the situation that two side-by-side peers can not quickly reconnect to each other when the network connection fails for a while . It's a real life issue that hopefully can be fixed in the future. Thanks for your valuable information. – Lewis Apr 03 '15 at 04:51
-
Once two peers on a LAN are connected, they should survive the internet going down (unless you're talking about the wifi dropping). Also, see this [other question](http://stackoverflow.com/questions/19675165/whether-stun-server-is-needed-within-lan-for-webrtc) about connecting on a LAN without internet. – jib Apr 03 '15 at 14:42
No they are not. Ice candidates contain end point's IP and port combination which can change. Even if you have a static IP address a new port number is generated every time.

- 1
- 3