8
votes

I am getting a below error in chrome console

XMLHttpRequest cannot load XMLHttpRequest cannot load turn:global.turn.twilio.com:3478/turn?username=username&key=key&transport=udp Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

while running a local webrtc sample server The node server example i am running is from https://github.com/ISBX/apprtc-node-server/

Below is the enter image description herescreenshot

Thanks in advance

1
Why are you trying to use XMLHttpRequest to make a request to a turn: URL?Quentin
I am just running the sample in the github and the turn server is got expired so i just got a free trun server from twillo and runned itbladeX
What protocol do you use?Alex Slipknot
hi alex i used https protocol for the nodejs server to runbladeX
Can you add your front-end code? As others have mentioned, I am skeptical of the reason for making an XHR to a TURN server.Nisarg

1 Answers

1
votes

I believe you have a misunderstanding of what a TURN server is for, and are calling it as if it is a standard web server.

As some of the commenters mentioned, you're not supposed to make an HTTP request to a TURN server, which uses a different TURN protocol. Instead, you configure your WebRTC setup via the iceServer object, which is where you define a TURN server. The WebRTC implementation will use the TURN servers when required.

Here's a nice article about WebRTC signaling:

https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/

And here's a couple other articles if you're interested in learning about the specific protocols WebRTC uses:

https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Protocols

https://www.twilio.com/docs/api/stun-turn/faq