Pauses the execution of a virtual user until notified to continue. The notification is typically sent from within a callback function. UserWaitFor takes a name as parameter to identify an event object that can be signaled by the UserSignal function.
The scope of this function is the virtual user context, which means that virtual users that use the same event object, do not interfere with each other.
kernel.bdh
UserWaitFor( in sWaitObjectName : string in nTimeout : number optional ): boolean;
Parameter | Description |
---|---|
sWaitObjectName | Name to identify the event object, which a virtual user is waiting to be signaled for |
nTimeout | Optional: Timeout for setting the value in seconds. If the specified time period is exceeded, the virtual user indicates an error and continues execution. The function's default behaviour is to wait forever. |
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://lnz-testsite:8080/atmosphere-meteor-pubsub-2.0.3/", "/atmosphere-meteor-pubsub-2.0.3/"); nAsyncChannel := WebAsyncPreparePush(callback(FAsyncCallback)); WebFormGet("http://lnz-testsite:8080/atmosphere-meteor-pubsub-2.0.3/pubsub/mychannel_1234", METEOR_PUB_SUB_FORM); UserWaitFor("LastMessage", 60); WebAsyncStop(nAsyncChannel); end TMainListen;