r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.48k stars 528 forks source link

[Question] Embedded HTTP server on unix domain socket #1393

Open gioboske opened 1 month ago

gioboske commented 1 month ago

Specification

Description

Is it possible to configure pywebview so to communicate with an HTTP server running over Unix domain socket (instead of specific local port)? Something similar to send requests with curl by using --unix-socket <path> option?

Thank you.

r0x0r commented 1 month ago

Not really, at least with the current http server implementation.

gioboske commented 1 month ago

What a pity! This would be very useful to run pywebview on systems where consuming a local port is not allowed or undesirable.

Any plan to support this feature in the near future?

In any case, thank you for the clarification and for the very useful pywebview.

r0x0r commented 1 month ago

pywebview uses bottle.py and its dev server for its http server. It may be not the best choice, but it does the job for now. bottle.py's dev server does not support binding to a unix socket.

You can use a third party http server of your choosing though. Start a server in a thread and point pywebview's url to the entrypoint provided by the server.

gioboske commented 1 month ago

Thank you @r0x0r. I will do some test using uvicorn, that support serving on unix domain socket.

Mi concern is about how to point pywebview's url to the server entrypoint, since the web server would listen on a unix socket and, as far as I know, there is no standard url scheme for unix domain socket. In fact, similar feature request for Chromium lead to a WONTFIX also for the lack of a standard url scheme.

I guess supporting unix socket would imply some changes on pywebview-side so to proxy all connections to the unix socket.

gioboske commented 1 month ago

In fact, similar feature request for Chromium lead to a WONTFIX also for the lack of a standard url scheme.

Just as reference, here the mentioned feature request for Chromium and a similar discussion on Bugzilla.

github-actions[bot] commented 5 days ago

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.