What's the difference with Flask and JSON-RPC

I want to make an application with Trytond as Backend, but I still sceptic using JSON RPC. What’s different between JSON RPC and Tryton-flask?

The main difference is:

  • With tryton-flask you are implementing an application/server which directly executes Tryton code and thus has direct access to all models, etc. You can imaging this as another trytond process offering a different (html) interface to the user and talks to the database. Your application doesn’t need to authenticate to trytond since it “is” trytond.

    User — Browser — tryton-flask — database
    AutomatedJob — tryton-flask — database
    
  • Contrary, when using JSON-RPC you are implementing an application/server that uses JSON-RPC to talk to a trytond prosess which talks to he database. Since your application/server is running as a different process your application needs to authenticate to trytond.

    User — Browser — YouApp — trytond — database
    User — SmartphoneApp — trytond — database
    AutomatedJob — trytond — database
    

Thus having said: tryton-flask saves you one tier, but also takes you one tier. :slight_smile:

Which one to choose depends. Here are some examples:

  • For a Smartphone-App you might choose JSON-RPC, since the app acts a rich client (provides the GUI) and can store the user’s credentials.
  • For a (low-volume) employee web-portal you might choose tryton-flask since this simplifes the architecture and peformance is not critical.
  • For a high-volume web-shop you might choose JSON-RPC as the additional tier might make it easier to scale and leverage modern web servers.
  • For automated jobs it might be easier to implement a JSON-RPC route for trytond than some REST (or other) interface in trytond-flask.

I’d be interested in other opinions on that.