Giter VIP home page Giter VIP logo

Comments (15)

kovalp avatar kovalp commented on May 26, 2024

I noticed that the notification ui.notify('my notification') does not work when run with the uds keyword ui.run(uds='/tmp/app.sock').

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

Other primitives (scene.line([0,0,0], [1,1,1])) are not shown if served via socket.

from nicegui.

falkoschindler avatar falkoschindler commented on May 26, 2024

Hi @kovalp,

We should make sure that the basic infrastructure works before looking into ui.scene. Does a simple button work that shows a notification?

ui.button('Hi!', on_click=lambda: ui.notify('Ho!'))

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

If I remove the keyword argument uds from my asgi.py script

from nicegui import ui
from test_nicegui.main import main

main()
ui.run()

and start serving from localhost (proxy_pass http://localhost:8080; in nginx conf), the issue persists.

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

Hi @kovalp,

We should make sure that the basic infrastructure works before looking into ui.scene. Does a simple button work that shows a notification?

ui.button('Hi!', on_click=lambda: ui.notify('Ho!'))

Hi,

No, this does not work in production. I see the button, but when I click on it, the notification wouldn't show up. In the development this button works.

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

If I make

    ...
    
    def my_function():
        print('print ho')
        ui.notify('Ho!')

    ui.button('Hi!', on_click=my_function)

then I can see 'print ho' in development run, but I cannot find in the production run (systemctl -l status nicegui-test)

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

Maybe this error message from systemctl status nicegui-test would give a clue?

Apr 22 09:00:26 ubuntu-2gb-nbg1-1 python[768]: NiceGUI ready to go on http://localhost:8080, and http://116.203.218.8:8080
Apr 22 09:01:37 ubuntu-2gb-nbg1-1 python[768]: Invalid websocket upgrade (further occurrences of this error will be logged with level INFO) 

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

I simplified the main.py down to one button

"""."""

from nicegui import ui

def main() -> None:
    """."""
    def my_function():
        print('print ho')
        ui.notify('Ho!')

    ui.button('Hi!', on_click=my_function)


main()
ui.run()

and it still would not work in production, while continuing to work in the development run.

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

Maybe this error message from systemctl status nicegui-test would give a clue?

Apr 22 09:00:26 ubuntu-2gb-nbg1-1 python[768]: NiceGUI ready to go on http://localhost:8080, and http://116.203.218.8:8080
Apr 22 09:01:37 ubuntu-2gb-nbg1-1 python[768]: Invalid websocket upgrade (further occurrences of this error will be logged with level INFO) 

This error seems to be known

https://stackoverflow.com/questions/78232346/invalid-websocket-upgrade

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

Maybe this error message from systemctl status nicegui-test would give a clue?

Apr 22 09:00:26 ubuntu-2gb-nbg1-1 python[768]: NiceGUI ready to go on http://localhost:8080, and http://116.203.218.8:8080
Apr 22 09:01:37 ubuntu-2gb-nbg1-1 python[768]: Invalid websocket upgrade (further occurrences of this error will be logged with level INFO) 

This error seems to be known

https://stackoverflow.com/questions/78232346/invalid-websocket-upgrade

This solves the issue. At least the button starts to work. It would be nice to give more details on the nginx configuration in the niceGUI documentation.

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

Everything else (3D spheres) works too. Feel free to close the issue.

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

The nginx config should contain the
lines

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";

in the server.location section

server {
server_name your.domain-name.ext;

    location / {
            include proxy_params;
            proxy_pass http://localhost:5000;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
    }

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

The docker image suggested in the documentation is not using nginx, so I wouldn't know how to configure nginx until I try.

from nicegui.

rodja avatar rodja commented on May 26, 2024

Have you seen our nginx example: https://github.com/zauberzeug/nicegui/tree/main/examples/nginx_subpath?

from nicegui.

kovalp avatar kovalp commented on May 26, 2024

Have you seen our nginx example: https://github.com/zauberzeug/nicegui/tree/main/examples/nginx_subpath?
Hi,

No, I did not find this config when I was looking. Anyway, I see that it is much more elaborated than the beginner's config I managed to compose.

This config needs another tutorial to explain the meaning/behavior of the software. I am afraid I need more explanations than in the provided read-me file :-)

from nicegui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.