You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is to separate the parser from the actual sending/receiving of messages so that there can be different implementations. With aiocoap being on the horizon (#28), I want to transform the library to be able to both support a sync and async API.
The code is already organized in such a way that the migration will be fairly painless. All writing is already done via a single method: set_values. Instead of having our methods call the API directly, we will have it return a command object. We then have different APIs that we can give the command to.
If the API wants to consume the response from the command, we can have a callback method be added to the command that can automatically be called by an implementing API.
command=light.update()
yieldfromapi(command)
# Under the hood api calls `command.set_result(result)`
The text was updated successfully, but these errors were encountered:
In the Python community there has been a movement to make Sans-IO libraries. For an intro, see this talk by Cory Benfield at PyCon 2016.
The idea is to separate the parser from the actual sending/receiving of messages so that there can be different implementations. With aiocoap being on the horizon (#28), I want to transform the library to be able to both support a sync and async API.
The code is already organized in such a way that the migration will be fairly painless. All writing is already done via a single method:
set_values
. Instead of having our methods call the API directly, we will have it return a command object. We then have different APIs that we can give the command to.The sync API would look like this:
If the API wants to consume the response from the command, we can have a callback method be added to the command that can automatically be called by an implementing API.
The text was updated successfully, but these errors were encountered: