Code Monkey home page Code Monkey logo

Comments (4)

thewhipster avatar thewhipster commented on May 18, 2024 2

Thanks Sebastian. I moved to your new FastAPI/Postgress stack and starlette's websockets are much more elegant to quickly leverage. That is awesome! Thank you for all the sharing you do, and effort in documentation. Maybe less obvious is how valuable working of your design patterns with the stacks are. I hadn't tackled Vue.JS before and extending from your patterns made it a piece of cake to learn!

from full-stack.

thewhipster avatar thewhipster commented on May 18, 2024

I suspect the answer to this comes along with a ASGI/FastAPI setup. Ready to tackle that down the road as i wrangle a SQLalchemy backend onto it.

from full-stack.

tiangolo avatar tiangolo commented on May 18, 2024

Hi @thewhipster !

Yep, my suggestion goes around FastAPI.

There's a new section in the docs about using WebSockets: https://fastapi.tiangolo.com/tutorial/websockets/

There's an equivalent full-stack project generator to this one, everything is equivalent except for being FastAPI instead of Flask (with a lot of plug-ins): https://github.com/tiangolo/full-stack-fastapi-postgresql

If you need specifically SocketIO, you probably can try https://python-socketio.readthedocs.io, and add it to your FastAPI app mounting it as an "ASGI" application: https://python-socketio.readthedocs.io/en/latest/server.html#uvicorn-daphne-and-other-asgi-servers

Let's say you have a SocketIO app:

sio = socketio.AsyncServer(async_mode='asgi')
sio_app = socketio.ASGIApp(sio)

You should be able to mount it in FastAPI with:

app.mount("/socket.io", sio_app)

from full-stack.

tiangolo avatar tiangolo commented on May 18, 2024

Thank you! That's great to hear! 😄 😊

I'm glad it's been helpful.

from full-stack.

Related Issues (16)

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.