Comments (2)
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:
- Modifying the entrypoint to your FlaskSocketIO app to use the AsynctionSocketIO class instead of flask_socketio.SocketIO. In a typical Flask-SocketIO setup, this should just be replacing the class name, and passing the additional
spec_path
argument to the constructor. - Removing the now redundant
@socketio
decorators from your existing event and error handlers. Asynction auto-registers these handlers by inspecting thex-handler
references within the spec file.
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 validation
parameter of the AsynctionSocketIO constructor). This would prevent existing client integrations breaking due to misdocumentation of existing event messages. Think of a scenario where an existing client arbitrarily passes additional arguments as part of the event payload. FlaskSocketIO does not care about schemata, and hence no exceptions are raised. However, Asynction may introduce a strict event schema which does not allow additional arguments. It's important to prevent breaking existing client integrations, and disabling the validation would ensure that. You may later enable the validation incrementally, starting with loose schemata and testing at pre-production environments, only promoting it to prod once you are confident that no existing integrations are to be broken.
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.
from asynction.
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!
from asynction.
Related Issues (16)
- Multiple asyncapi yaml files HOT 5
- /docs does not work with asyncapi 2.2.0 HOT 1
- Security schemes HOT 5
- Per namespace security HOT 1
- python3.6 support HOT 4
- Docs viewer unhappy with Oauth2 Security scheme HOT 5
- Support for namespace classes HOT 1
- Bug with array payload validation HOT 6
- Support emitting events from an external process
- 1.0.0 release checklist
- docs: contribution section HOT 4
- Payload validator fails with oneOf in payload HOT 4
- All message payload and ack argument schemata should be tuples HOT 1
- CI should verify python version compatibility
- Document examples of using Asynction
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asynction.