fossasia / knitlib

Knitting backend library for knitting machines
GNU Lesser General Public License v3.0
1.54k stars 14 forks source link

Improving plugin-user communication API. #20

Closed tian2992 closed 9 years ago

tian2992 commented 9 years ago

Defining a clear way for plugins to communicate errors or status to user facing UIs (load yarn, error has occurred, etc)

tian2992 commented 9 years ago

Working on it on d71c415bb9ecca6cbf62404e8b5a8638cba4634c

tian2992 commented 9 years ago

More progress on 4c8460eb35b42720e8ca6318d402e013ac6937a5 Still pending adaptation to AYAB plugin.

tian2992 commented 9 years ago

Added async callbacks dict in order to handle User Machine communcation in an abstract way. Solving the Inversion of Control problem.

Note that this leaves the responsibility to handle session and UI control to another layer, namely knitweb backend.

tian2992 commented 9 years ago

Seems async (and blocking) callbacks are used too in the UI and some parts of PDD emulator, so can be adapted for both plugins.

tian2992 commented 9 years ago

I'd like to do a Web API draft before freezing this API. Server will need to be compatible with push notifications, websockets or some notification in order to block until user operation is completed.

tian2992 commented 9 years ago

We have settled on async callbacks using Web Sockets which will be handled on Knitlib-webserver.

Will add some tests and close.

tian2992 commented 9 years ago

Callbacks are the main communication method for bidirectional plugin support.