So I completely understand how to use getIceServers via your demo, but what's the best practice for implementing on the server side / compiled client-side?
"This token should only be implemented in a secure environment, such as a server-side application or a compiled client-side application."
Do the list of IceServers expire at some point? Should I request new IceServers on each page request or do I cache the list for X amount of time?
The Ice Server credentials expire after about 10 seconds. Because you want to keep your XirSys secret token secure (so no one can hack your account's connection allotment), you'll want to make a backend/server side curl request for the ice servers. It's assumed that your app uses its own authentication. I.e., it'll reject any non-authenticated requests to https://yourdomain.com/ajax/get-ice-servers.
So ... whenever you need to create a PeerConnection object, get a list of Ice servers through an Ajax call ...
where ...
Note you'll want a synchronous ajax request so the getIceServers() function returns the result before RTCPeerConnection is instantiated.
Also note that if you start a webRTC connection automatically on page load, then you could probably just use the iceServers result from the server curl request.