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

Allow ws access when remotely accessing openrvdas webUI via port forwarding #337

Open
webbpinner opened this issue Jul 20, 2023 · 6 comments

Comments

@webbpinner
Copy link
Contributor

Several vessels provide remote access to the OpenRVDAS via ssh-based port forwarding. This works for the static portions of the OpenRVDAS webUI but because the port used for the ws connection is explicitly defined to a port number within the settings.py file the ws socket traffic is not accessible when accessing via ssh port-forwarding.

Running on the assumption that the WS port is the same as the port used by nginx during install would it be possible to define the ws port as the same port specified in the URL.

TL;DR
Can the default vault of WEBSOCKET_SERVER be changed from:

var WEBSOCKET_SERVER = "ws://:80/cds-ws";

To:

var WEBSOCKET_SERVER = (document.location.protocol === 'https:' ? 'wss' : 'ws' ) + '//:' + document.location.port + "/cds-ws";
@davidpablocohn
Copy link
Collaborator

davidpablocohn commented Jul 20, 2023 via email

@webbpinner
Copy link
Contributor Author

webbpinner commented Jul 20, 2023

It's in:
https://github.com/OceanDataTools/openrvdas/blob/master/django_gui/templates/django_gui/index.html
but that file just refers back to what's set in settings.py... or at least that's the way I'm interpreting the code

@davidpablocohn
Copy link
Collaborator

davidpablocohn commented Jul 20, 2023 via email

@webbpinner
Copy link
Contributor Author

I was curious about that. My initial thought was that the string would be not be interpreted until it was in the browser which I assumed would be fine as just a JS string passed to the template via the Django code. I might be wrong in that assumption.

@LMG-ET
Copy link
Contributor

LMG-ET commented Mar 28, 2024

We've solved that one.
We tweaked ${OPENRVDASROOT}/display/js/widgets/settings.js

var WEBSOCKET_PORT = window.location.port || 443;

That file may or may not have been generated by something further upstream (I'd have to run through the installation script and whatnot to give you a definitive answer), but ....

Standard disclaimer: It works for me !!

@davidpablocohn
Copy link
Collaborator

davidpablocohn commented Apr 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants