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

[Question] Channels 4.x support ? #22

Open
JhonFrederick opened this issue Jul 19, 2023 · 3 comments
Open

[Question] Channels 4.x support ? #22

JhonFrederick opened this issue Jul 19, 2023 · 3 comments

Comments

@JhonFrederick
Copy link

Hi,
Looking at the notes at https://channels.readthedocs.io/en/stable/releases/4.0.0.html I don't feel that there are too many changes to prevent my use of channels 4, however, I would like to know if you recommend me to only use channels 3.XX? If so, when is channel 4.xx support planned?

Thanks

@sivulich
Copy link
Owner

Hi Jhon,

You're right, have you tested it with channels 4.x.x?

I will try to run the compatibility checks and update the docs if it works as expected. If not I will update the library to support channels 4.x.x

@JhonFrederick
Copy link
Author

You're right, have you tested it with channels 4.x.x?

We are just doing the integration and testing
On the other hand, out of support with Django 4.x., with our team we have a question, something like this can be done:

...
application = ProtocolTypeRouter(
    {
        "http": get_asgi_application(),
        "mqtt": URLRouter([
            path("my/testing/+/tempeture/", TempetureConsumer.as_asgi()),
            path("my/testing/+/topic/", TopicConsumer.as_asgi()),
        ]),
    }
)

Based on https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/ or similar
image
The above to have a better organized pool of mqtt consumers and not everything that is required in a single consumer

Thanks again

@sivulich
Copy link
Owner

sivulich commented Aug 6, 2023

There are two ways of supporting two consumers:

  1. Use the worker API to create two workers that subscribe to different topics. The advantage here is that it runs in a single thread, so for lightweight things this is good.
  2. Create two applications with diffrent consumers and run them as separate processes.

For option 1 you can create a base worker called an orchestrator that spawns both processes that need to be run :)
Happy to discuss further if needed.

A third option would be to create an mqtt topic router to spawn them, I'll also look at doing this

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

No branches or pull requests

2 participants