webRTC on isolated LAN - Without ice/stun/turn ser

2019-03-11 01:04发布

问题:

Please help! On an isolated LAN, is there any way that a webRTC connection can be made simply with the IP addresses assigned by the DHCP server? I have a classroom of kids in a school with the policy against student wireless internet access. I also have my own web application that I can host on an in-room wireless network, and I'd like to use it so I can get real-time student responses into my own browser. Once they're in my browser, I can cache them with localStorage and open up a world of assessment possibilities.

I understand that I can accomplish this with Node.js and Socket.io-- but I was really hoping to avoid setting up that kind of server with my limited skill set. I'm a science teacher who dabbles in programming, so feel free to 'keep it simple'. Thank you!!

UPDATE

Alex, you are correct that I can avoid using a STUN server if all of the computers are on the same local network. Although I had to bite the bullet and install Node.js on my laptop, it was really wasn't complicated. I then tried a whole bunch of 'working examples' that didn't work for me, until I found this one and his GitHub files.

After running the server script in Node, I had a DataChannel connection between two browser windows on the same machine, but not between different computers. I edited the .html files to point to my local server IP address instead of 'localhost' and I could then connect with multiple computers! Then came the real test-- could I use this without an internet connection? I found the line that specified using Google's STUN servers and changed it from

var config = {"iceServers":[{"url":"stun:stun.l.google.com:19302"}]};

to just

var config = {"iceServers":[]};

It worked. :-)