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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃 Add example app with websocket endpoint and dynamic MQTT subscriptions #83

Merged

Conversation

azogue
Copy link
Collaborator

@azogue azogue commented Dec 30, 2023

closes #52, #71

Add a 3rd fastAPI app example, showing the following:

  • App split in submodules, with separate router, usage of Depends, etc.
  • App Lifespan usage
  • Websocket endpoint to dynamically subscribe to topics and receive MQTT messages, as a wrapper over FastMQTT

Usage with:

# install websockets if necessary
pip install websockets
# run example app
uvicorn examples.ws_app.app:application --port 8000
# and navigate to http://localhost:8000/home

cc @MoonCactus, @sabuhish

@azogue azogue merged commit e7c2c71 into sabuhish:master Dec 30, 2023
1 check passed
@azogue azogue deleted the example/ws-endpoint-with-dynamic-subscriptions branch December 30, 2023 14:23
@MoonCactus
Copy link

Yes, dynamic subscription does fix my needs indeed.
Oh and happy new year, thanks for your support @azogue 馃憤

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

Successfully merging this pull request may close these issues.

How to feed mqtt messages from within a fastapi websocket ? (ie. proxying)
2 participants