-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add WebSocket Examples #152
Comments
Hi, and thanks for trying to make fastapi-template even better. That's a good idea. I'll look into it this evening. Can you provide some ideas what should be done in this example? Simple echo server, or maybe something more mature? |
I believe that a simple echo server and an example with a dummy model would be good examples to include in the project. In the dummy model example, we could have clients subscribe to changes in the model, and have the server broadcast updates to all connected clients. This would demonstrate how WebSockets can be used to create real-time, collaborative applications. |
I guess that subscribing for a model updates is a very big example. Maybe small message broadcasting would be enough? Like if someone writes a message, it sends to all connected people? But I'm not sure that this is what is really needed, since these examples are exist here in fastapi docs. |
I don't really want to create a really big example, since it would be hard to support. But what I really like is the idea to show the example how to test websockets. So maybe echo or broadcast is enough. |
I agree that subscribing to model updates may be a big example, and a simple echo or broadcast may be sufficient. However, I would still like to propose including an example that demonstrates the proper use of DI with WebSockets. Because, there are issues with DI in FastAPI that are not well-documented, and I believe that including an example would be very helpful for developers who are new to FastAPI or WebSockets. In fact, I recently came across a discussion on GitHub where this issue was raised. Here is the link. As you can see, there are developers who have experienced problems with DI in FastAPI and would benefit from a clear example. |
I have same issue now.... |
Hello,
I noticed that the current version of the FastAPI-Template project does not include examples of using WebSockets with FastAPI. I think adding these examples would be helpful for developers.
It's worth noting that DI for WebSockets is different from DI for HTTP routes and testing.
I want to suggest adding examples of using WebSockets to the project.
I'm willing to help with this and can provide code examples as needed.
The text was updated successfully, but these errors were encountered: