Retrieves the HTTP headers of the response sent by the server through an asynchronous communication channel. This function can only be called in an asynchronous callback function.
webapi.bdh
WebAsyncGetResponseHeaders( out sHeaders : string ): boolean;
| Parameter | Description |
|---|---|
| sHeaders | Out variable, which receives the HTTP headers string. |
true if successful
false otherwise
dclfunc
function FAsyncCallback(sResponseBody : string) <ASYNC_CALLBACK_FUNCTION>
var
sHeader : string;
begin
WebAsyncGetResponseHeaders(sHeader);
RepMessage("HEADER: '" + sHeader + "'", SEVERITY_INFORMATIONAL);
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;
sParsedTrackingId : string;
begin
WebPageUrl("http://demo.borland.com:8080/atmosphere-meteor-pubsub-2.1.3/", "/atmosphere-meteor-pubsub-2.0.3/");
Print("sTrackingId: '" + sTrackingId + "'");
WebParseDataBoundEx(sParsedTrackingId, STRING_COMPLETE, "\n", 0, "|", WEB_FLAG_ALL_RESPONSES | WEB_FLAG_CASE_SENSITIVE, 1);
WebFormGet("http://demo.borland.com:8080/atmosphere-meteor-pubsub-2.1.3/pubsub/mychannel_1234",
METEOR_PUB_SUB_FORM, 5.0);
sTrackingId := sParsedTrackingId;
Print("sTrackingId: '" + sParsedTrackingId + "'");
nAsyncChannel := WebAsyncPrepareLongPoll(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;