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.73k stars 554 forks source link

Is Websocket support planned? #688

Closed naiteon closed 3 years ago

naiteon commented 3 years ago

I have a local html file in a raspberry pi that i open thru chromium in kiosk mode. It works really well connects to both local and remote websocket servers. But I'm afraid it is gonna mess up in the future since there is no way to stop chromium from trying to auto update and who knows which undesired UI prompt or window they may come up with next release, which i can't show to the kiosk users!

I tried this module then in the hopes i could have a webview without future messes from chromium BUT unfortunately it can't connect to any websocket server. I tried to read through the issues to see if websocket is supported but it is still inconclusive.

Is there any flag or parameter required to enable websocket?

r0x0r commented 3 years ago

As you have probably seen already there are a couple of old issues related to web sockets, all of them are resolved in one way or another. I have not personally tested web sockets on RPI or elsewhere, so I have no idea how well it is supported. GTK is currently the only viable renderer choice for RPI and the truth is it is not very capable.

I think the best course would be to get QT with QTWebEngine support up and running on RPI. I have investigated it to some extent as described here https://github.com/r0x0r/pywebview/issues/523, but could not get it running. More specifically QT works fine, but not QTWebEngine. Help is appreciated.

naiteon commented 3 years ago

Thank you so much for your attention and kind response @r0x0r ! I ended up using GTK and WebKit2 in C++. I think we could make a webkit2 binding through gtk. I could help if you want.

r0x0r commented 3 years ago

Pywebview uses GTK and WebKit2 already. Is C++ variant any different?

naiteon commented 3 years ago

Oh that's weird! yeah i tried pywebview and the html/js loaded successfully but the websocket connection wouldn't work. When I tried the equivalent example with C++ it worked, both the html js and websocket worked. I don't know exactly why, but I can guarantee you the files were the same! In c++ i used the webview_web_view_load_uri (and also webview_web_view_load_html) both worked out of the box.

On 27 Jan 2021, at 14:41, Roman notifications@github.com wrote:

Pywebview uses GTK and WebKit2 already. Is C++ variant any different?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/r0x0r/pywebview/issues/688#issuecomment-768455128, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX4EXUGVIEMNQBW3Q6MALLS4BF4ZANCNFSM4WTW375A.

naiteon commented 3 years ago

On the raspberry pi I've used these libraries:

libgtk-3-dev libwebkit2gtk-4.0-37 libwebkit2gtk-4.0-dev

r0x0r commented 3 years ago

pywebview uses PyGObject with relies on the same libraries. Might it be a case of old PyGObject installed or something along these lines?

naiteon commented 3 years ago

Maybe that could be the case because I believe I was using python 3 but looking for PyGObject I only found it under python2 libs:

/usr/lib/python2.7/dist-packages/PyGObject-3.30.4.egg-info

On 28 Jan 2021, at 10:08, Roman notifications@github.com wrote:

pywebview uses PyGObject with relies on the same libraries. Might it be a case of old PyGObject installed or something along these lines?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

github-actions[bot] commented 3 years 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.

github-actions[bot] commented 3 years ago

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.