Git Product home page Git Product logo

Comments (3)

sivulich avatar sivulich commented on August 15, 2024 1

from mqttasgi.

sivulich avatar sivulich commented on August 15, 2024

Hi @SootyOwl thanks for your comments.

Your usage is correct, I think it's related to a possible bug here:
line 12 of utils.py

I think it should be:

    return application.as_asgi()

Let me know if that change works for you and I'll create a PR with the fix.

from mqttasgi.

SootyOwl avatar SootyOwl commented on August 15, 2024

Hi @sivulich

I tried the change above but was presented with another exception:

Traceback (most recent call last):
  File "/usr/local/bin/mqttasgi", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/mqttasgi/cli.py", line 41, in main
    application = get_application(args.application)
  File "/usr/local/lib/python3.10/site-packages/mqttasgi/utils.py", line 13, in get_application
    return application.as_asgi()
AttributeError: 'ProtocolTypeRouter' object has no attribute 'as_asgi'

I managed to "solve" this problem by changing

return application
to

    if hasattr(application, 'as_asgi'):
        return application.as_asgi()
    return application

This doesn't present any errors, and a worker now successfully spawns!

DEBUG [mqttasgi.cli:208] [mqttasgi][app][subscribe] - Subscription to dt/#:0 has 2 listeners

from mqttasgi.

Related Issues (19)

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.