Closed RomRider closed 2 years ago
This might be a tough one. I do not have my system on https and wss: does not work for me. I have looked into setting my system up behind https and the cert and config requirements are beyond what I am comfortable doing on Linux. So it will be impossible for me to test. And there may be other issues running https besides the ws/wss.
Here is what I could do. If you want to go in and edit the source file ~/pgcode/printerconnection.js around line 428
let socketUrl = "wss://"+socketHost+"/websocket"+"?token="+result
IF that works for you then I could add an option to the connection dialog to force WSS.
It's straightforward with that change and works perfectly (I've already forked and tested with the wss hard-coded as I had planned to PR something)
If you want to add a setting, that's good enough, I mainly wanted to see if you had plans for that :)
Will this change work?
` let socketHost=socketUrl.host; if ("WebSocket" in window){ let socketUrl = "ws://"+socketHost+"/websocket"+"?token="+result
if(serverUrl.toLowerCase().startsWith("https")) socketUrl = "wss://"+socketHost+"/websocket"+"?token="+result
`
Sorry, for some reason I can't get the above code to format.
@RomRider I released a change for this. Let me know if it doesn't fix it.
Hi,
Great project, thanks :)
I'm running all my moonraker instances behind a central https reverse proxy including pgcode itself (traeffik). If pgcode is accessed through https, the ws connection to moonraker has to be over
wss://
but currently it's hardcoded asws://
thus failing with: