raiden icon indicating copy to clipboard operation
raiden copied to clipboard

[Meta] Add asynchronous APIs

Open hackaugusto opened this issue 4 years ago • 1 comments

Abstract

Currently we provide a very simple model, the HTTP request blocks until the operation is known to be safely finished, or error.

This means that REST requests that result in chain transactions will block until the transaction is mined and confirmed, which can take a little while.

Motivation

The above approach is fine for some use cases, however it lacks visibility on what is happening in Raiden node. To improve the visibility of the system the API has to move away from blocking for the complete operation, and return data more often to the API user.

For transactions that means that once a transaction is sent the tx_hash can be returned to the client, and once the transaction is mined the result of the operation can be returned.

There are two models we can use, one that pushes notifications through a socket, e.g. a websocket. Another model is to use long polling. Infrastructure wise both model should be very similar.

hackaugusto avatar Dec 06 '19 12:12 hackaugusto

An interim solution would be to keep the existing API, but provide an extra endpoint that could provide server-side events, or any other form of asynchronous server -> client communication.

This would allow the developers to make the changes piecemeal, or only for the points of interested for other consumers of the API.

lullis avatar Feb 24 '22 19:02 lullis