Recent

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

Prakash

  • Jr. Member
  • **
  • Posts: 59
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: 1209
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: 12974
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).
I actually get compliments for being rude... (well, Dutch, but that is the same)

Prakash

  • Jr. Member
  • **
  • Posts: 59
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