Recent

Author Topic: We want call text api in async  (Read 675 times)

Prakash

  • Full Member
  • ***
  • Posts: 169
We want call text api in async
« on: February 01, 2023, 10:45:03 am »
How to call rest api async in Lazarus.

Delphi I think it support task

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: We want call text api in async
« Reply #1 on: February 02, 2023, 11:25:45 am »
TTask in Delphi is basically just a Thread in Disguise. There is no real async Tasking (as you might know it from other languages like C#, Javascript, Python and co.) in Delphi.

So from this point of view, you can simply use TThread to make your request be executed in parallel and react to it finishing

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: We want call text api in async
« Reply #2 on: February 02, 2023, 11:38:58 am »
https://wiki.freepascal.org/Asynchronous_Calls

But in trunk/main you can use an anonymous procedure call using TThread.

Both methods are somewhat equivalent to TTask (which is easy to implement with both options).
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Prakash

  • Full Member
  • ***
  • Posts: 169
Re: We want call text api in async
« Reply #3 on: February 12, 2023, 07:21:41 am »
Thanks. I have implemented in http calls , it is working .

 

TinyPortal © 2005-2018