WebAsyncStop Function

Action

Stops an asynchronous communication channel and aborts outstanding requests of this channel.

Include file

webapi.bdh

Syntax

WebAsyncStop( nAsyncHandle : number ): boolean;
Parameter Description
nAsyncHandle The handle value of the asynchronous communication channel, which was returned by a preceding WebAsyncPrepare...() function.

Return value

  • true if successful

  • false otherwise

Example

dclfunc
  function FAsyncCallback(sResponseBody : string) <ASYNC_CALLBACK_FUNCTION>
  begin
    RepMessage("MESSAGE: '" + sResponseBody + "'", SEVERITY_INFORMATIONAL);
    if (StrSearch(sResponseBody, "last message", STR_SEARCH_FIRST) <> 0) then
      UserSignal("LastMessage");
    end;
  end FAsyncCallback;

dcltrans
  transaction TMainListen
  var
    nAsyncChannel : number;
  begin
    WebPageUrl("http://demo.borland.com:8080/atmosphere-meteor-pubsub-2.1.3/", "/atmosphere-meteor-pubsub-2.0.3/");
    nAsyncChannel := WebAsyncPreparePush(callback(FAsyncCallback));
    WebFormGet("http://demo.borland.com:8080/atmosphere-meteor-pubsub-2.1.3/pubsub/mychannel_1234", 
      METEOR_PUB_SUB_FORM);

    UserWaitFor("LastMessage", 60); 
    
    WebAsyncStop(nAsyncChannel);
    
  end TMainListen;