-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require not defined #7
Comments
looks like the second line is actually var portcontrol = freedom.freedom('node_modules/freedom-port-control/dist/port-control.json'); |
it give me no error, but when I test :
there is
Result of a
|
you probably have a promise that resolves to the expected interface. Sorry - all of the calls will be asynchronous promises, rather than direct returns. var freedom = require('freedom-for-node');
freedom('node_modules/freedom-port-control/dist/port-control.json').then(function(portControl) {
return portControl.probeProtocolSupport();
}).then(function(support) {
console.log(support);
}); |
Ok, I followed the code example and the
but I got new errors :
It seems that |
Sigh. Didn't realize this code had a dependency on WebRTC - probably to learn your external IP address through the STUN process. I don't think i've ever made that work in a reliable way in node.js, although that's probably worth doing. The alternative is to not use STUN, or use it as a UDP protocol rather than bundled in webRTC. |
Mhm ok, thank you for your help ! |
Actually, I think this error is because we're using the URL interface that's only supported in Chrome or Firefox, and not in node. This was fine since our initial use case was only in browser apps. From a quick look, it seems like Also, if I recall correctly, WebRTC is only used to determine the private IPs of the computer, which is done by gathering ICE candidates on a dummy data channel – no STUN servers are actually used. |
Yeah, it looks like there will be minor incompatibilities with the current code and node. @willscott what do you think is the best way to deal with this? |
If you need XMLHttpRequest in a freedom module, you might like https://github.com/uproxy/freedom-xhr |
After a successful
npm install freedom-port-control
andnpm install freedom-for-node
, running :give me an error :
TypeError: freedom is not a function
Running :
var portcontrol = freedom.freedom('node_modules/freedom-port-control/src/port-control.json');
I have this error :
[ReferenceError: require is not defined]
Do you know why ?
Thank you
The text was updated successfully, but these errors were encountered: