Skip to content
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

Scope: web socket uses hard coded local IP address #375

Closed
jarmitage opened this issue Mar 17, 2018 · 7 comments
Labels

Comments

@jarmitage
Copy link
Contributor

@jarmitage jarmitage commented Mar 17, 2018

ws = new WebSocket("ws://192.168.7.2:5432/scope_control");

var ws = new WebSocket("ws://192.168.7.2:5432/scope_data");

@jarmitage jarmitage added bug IDE labels Mar 22, 2018
@jarmitage

This comment has been minimized.

Copy link
Contributor Author

@jarmitage jarmitage commented Mar 24, 2018

Tried this but unable to get a connection

var ip = location.host;
var ws = new WebSocket("ws://"+ip+":5432/scope_data");
var ws_onerror = function(e){
	setTimeout(() => {
		ws = new WebSocket("ws://"+ip+":5432/scope_data");
		ws.onerror = ws_onerror;
		ws.onopen = ws_onopen;
		ws.onmessage = ws_onmessage;
	}, 500);
};
ws.onerror = ws_onerror;
@giuliomoro

This comment has been minimized.

Copy link
Contributor

@giuliomoro giuliomoro commented Mar 24, 2018

did you gulp ?

console.log("ws://"+ip+":5432/scope_data") ?

also, what does the console say?

@jarmitage

This comment has been minimized.

Copy link
Contributor Author

@jarmitage jarmitage commented Mar 24, 2018

If browser is at http://192.168.7.2/scope/:

scope-worker.js:8 WebSocket connection to 'ws://192.168.7.2:5432/scope_data' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
scope-browser.js:32 WebSocket connection to 'ws://192.168.7.2:5432/scope_control' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

If browser is at http://192.168.1.XXX/scope/ (with Bela on WiFi):

scope-worker.js:8 WebSocket connection to 'ws://192.168.1.XXX:5432/scope_data' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
scope-browser.js:32 WebSocket connection to 'ws://192.168.1.XXX:5432/scope_control' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
@jarmitage

This comment has been minimized.

Copy link
Contributor Author

@jarmitage jarmitage commented Mar 24, 2018

console.log("ws://"+ip+":5432/scope_data") => ws://192.168.7.2:5432/scope_data

@giuliomoro

This comment has been minimized.

Copy link
Contributor

@giuliomoro giuliomoro commented Mar 24, 2018

I think you may have forgotten to gulp? If you can't be bothered to set up your gulp environment, for quick fixes like this you can edit the gulp-generated files in IDE/public/scope/js/ directly.

Anyhow, fixed now.

@jarmitage

This comment has been minimized.

Copy link
Contributor Author

@jarmitage jarmitage commented Mar 24, 2018

Hmm that's weird, I had gulp running as in the instructions here: https://github.com/BelaPlatform/Bela/wiki/Developing-for-the-IDE

I will reboot and try again with your fix

@giuliomoro

This comment has been minimized.

Copy link
Contributor

@giuliomoro giuliomoro commented Mar 24, 2018

did you also edit Bela/IDE/public/scope/js/scope-worker.js ?
you could just grep -RI 192.168.7.2 IDE to make sure there is nothing left in there. Also maybe your browser is lazy in reloading the js files?

jarmitage added a commit to jarmitage/Bela that referenced this issue Mar 25, 2018
Using IP address of the page instead of hardcoded one. Closes BelaPlatform#375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.