Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.3 KB

asynchronous.rst

File metadata and controls

31 lines (23 loc) · 1.3 KB

Asynchronous

Now we have supported the use of asynchronous methods to submit transactions, py-stellar-sdk gives you the choice, rather than forcing you into always writing async; sync code is easier to write, generally safer, and has many more libraries to choose from.

:pyServer <stellar_sdk.server.Server> has one parameter is client, here we need to talk about the client parameter, if you do not specify the client, we will use the RequestsClient <stellar_sdk.client.requests_client.RequestsClient> instance by default, it is a synchronous HTTPClient, you can also specify an asynchronous HTTP Client, for example: AiohttpClient <stellar_sdk.client.aiohttp_client.AiohttpClient>. If you use a synchronous client, then all requests are synchronous, if you use an asynchronous client, then all requests are asynchronous.

The following is an example of send a payment by an asynchronous method, the same example of using the synchronization method can be found here:

../../examples/payment_async.py

The following example helps you listen to multiple endpoints asynchronously.

../../examples/stream_requests_async.py