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

Static Port for Browser app (Issue #2144) #2145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cagnulein
Copy link
Owner

Static Port for Browser app (Issue #2144)

@cagnulein cagnulein added this to the 2.16 milestone Feb 20, 2024
Copy link

stale bot commented Mar 6, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 6, 2024
@stale stale bot closed this Mar 14, 2024
@cagnulein cagnulein reopened this Mar 14, 2024
@stale stale bot removed the wontfix This will not be worked on label Mar 14, 2024
Copy link

stale bot commented Mar 30, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 30, 2024
@stale stale bot closed this Apr 9, 2024
@cagnulein cagnulein reopened this Apr 10, 2024
@stale stale bot removed the wontfix This will not be worked on label Apr 10, 2024
Copy link

stale bot commented Apr 26, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 26, 2024
@stale stale bot closed this May 3, 2024
@cagnulein cagnulein reopened this May 3, 2024
@stale stale bot removed the wontfix This will not be worked on label May 3, 2024
Copy link

stale bot commented May 18, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 18, 2024
@stale stale bot closed this May 25, 2024
@cagnulein cagnulein reopened this May 25, 2024
@stale stale bot removed the wontfix This will not be worked on label May 25, 2024
Copy link

stale bot commented Jun 9, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jun 9, 2024
@stale stale bot closed this Jun 16, 2024
@cagnulein cagnulein reopened this Jun 16, 2024
@stale stale bot removed the wontfix This will not be worked on label Jun 16, 2024
Copy link

stale bot commented Jul 1, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jul 1, 2024
@stale stale bot closed this Jul 8, 2024
@stale stale bot added the wontfix This will not be worked on label Oct 17, 2024
@stale stale bot closed this Oct 28, 2024
@cagnulein cagnulein reopened this Oct 28, 2024
@stale stale bot removed the wontfix This will not be worked on label Oct 28, 2024
Copy link

stale bot commented Nov 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 13, 2024
@stale stale bot closed this Nov 23, 2024
@cagnulein cagnulein reopened this Nov 23, 2024
@stale stale bot removed the wontfix This will not be worked on label Nov 23, 2024
Copy link

stale bot commented Dec 8, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 8, 2024
@stale stale bot closed this Dec 18, 2024
@cagnulein cagnulein reopened this Dec 18, 2024
@stale stale bot removed the wontfix This will not be worked on label Dec 18, 2024
Copy link

stale bot commented Jan 2, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jan 2, 2025
@stale stale bot closed this Jan 9, 2025
@cagnulein cagnulein reopened this Jan 9, 2025
@stale stale bot removed the wontfix This will not be worked on label Jan 9, 2025
Copy link

stale bot commented Jan 25, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jan 25, 2025
@stale stale bot closed this Feb 1, 2025
@cagnulein cagnulein reopened this Feb 1, 2025
@stale stale bot removed the wontfix This will not be worked on label Feb 1, 2025
Copy link

stale bot commented Feb 16, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 16, 2025
@evan-kolberg
Copy link

I developed a workaround if someone would want to connect to the localhost websocket - Works on macOS, possibly Linux, and not Windows. Thanks to @cagnulein for helping me via email.

Screenshot 2025-02-20 at 8 03 18 PM

How I did this:

  1. Launched QZ
  2. Went to General UI Options in Settings
  3. Scrolled down and clicked on OPEN FLOATING ON A BROWSER - whatever the heck that means
  4. Inspected the page and went to Sources
  5. Found the main_ws_manager.js and global.js files
  6. Noticed that the localhost port changed each time the QZ app restarted
  7. Since on macOS, ran lsof -iTCP -sTCP:LISTEN in Terminal.app
  8. Saw that there were 4 options for ports and 1 of them was the socket port.
  9. Translated the JavaScript code into Python
  10. Implemented a function to find the websocket port from the parent process named qdomyoszw
  11. Was able to successfully read data from the open websocket

How to run the code (if on macOS, maybe Linux):

  1. Launch QZ
  2. Git pull the repo (or add it as a submodule) and pip install the websocket library
  3. Run main_macOS.py

Your output should look like this:
Screenshot 2025-02-20 at 8 19 27 PM

This doesn't directly give a static port for the browser app, but it offers a solution to those who want to connect to the localhost websocket.

I still don't know what the Server Port: 36866 option does under Experimental Features does. Is this for emitting Bluetooth signals with Mqtt or OSC? I don't know.

--
Evan

@stale stale bot removed the wontfix This will not be worked on label Feb 21, 2025
@cagnulein
Copy link
Owner Author

The server port is, if I remember correctly, for the templates done by @p3g4asus

@p3g4asus
Copy link
Contributor

I had to review the code because I completely forgot it. However it is pretty simple. When a template is found, the settings are searched for the key "template_[templateId]_port". If it is found and it is not >0 and < 65535, that port number is used. If it is found and it is 0, the first time the template is started, the port is set randomly and saved in settings so that it will remain fixed for every next start. If it is not found, it is set to a default value that is 6666. So I think that if you delete that line of code for windows build, you will have QZ windows inner web server on port 6666.

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

Successfully merging this pull request may close these issues.

3 participants