-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Incorporating asynction into existing flask API with socketio events #286
Comments
Hey @AFlowOfCode! Thanks for your feedback and apologies for the late response. Asynction is built on top of Flask-SocketIO and is fully compatible with it. Essentially, the AsynctionSocketIO class (which is the entrypoint to any asynction app) inherits from the flask_socketio.SocketIO class. Asynction only adds auxiliary capabilities on top of the core functionality of FlaskSocketIO, which is left intact. Wrt onboarding an existing API to Asynction, the main piece of work would be to come up with the actual spec of your API, which is then going to be fed into Asynction. You may find this blog post particularly helpful when attempting to model your existing SocketIO API in AsyncAPI. Once you got your spec finalised, transitioning from vanilla FlaskSocketIO to Asynction flavoured FlaskSocketIO should be relatively trivial, especially for an application involving <10 events. A typical migration would involve:
Since this is an operational API that clients currently depend on, I would strongly advise in favour of disabling validation of incoming event payloads, especially when the migration is first rolled out (see the Please take all of the above with a pinch of salt. The answer to your question vastly depends on the specifics of your application. Let me know if you would need further help. Will try to be more swift with my response times. |
The blog post looks very helpful. I'll close the issue as this has given me an idea of what it will take and a great starting point. Thanks for your thorough response! |
Hi there, this project looks really interesting & I have a question which I hope is not out of place.
I have an API in development which uses flask and flask-restx for generating an openapi spec upon which several developers are dependent in order to develop front-end applications. There is also a small set of websocket events (one path, 3 - 5 events) implemented via flask-socketio, and I am really missing the Swagger-style documentation when it comes to the socketio pieces. That ultimately led me to AsyncAPI & then asynction.
I've already missed the "spec first" boat since the code is already implemented. But I'm wondering if I should back up and incorporate asynction in order to be able to properly integrate some nice documentation.
My question is, given the fact I'm already running an operational API with some websocket events, how complicated would it be to add in asynction at this point and convert my existing events? I haven't had the chance to fully look into how things work with asynction yet, so I appreciate any thoughts about the complexity such a transition might pose. Thanks!
The text was updated successfully, but these errors were encountered: