ReRun the same script

I have a server action that runs in a condition, on the client side, I have it set to on success rerun the same script over and over again.
That all works well, however to stop the script when I know it is really done, I have set a server connect response code of 204 which stops the script sending the success event.

This has me wondering what codes I can use on my server scripts that App Connect listens for, if success is 200, then what code is used for say the done dynamic event.

Could this list be completed, and/or corrected if I already have some codes wrong, I assume some of these are specific to Wappler / App Connect / Server Connect, but I assume some are just the universal status codes.

Dynamic Event HTTP Status Code
dmx-on:success 200
dmx-on:start ???
dmx-on:done ???
dmx-on:error 500
dmx-on:unauthorised 401
dmx-on:forbidden 403
dmx-on:abort ???
dmx-on:invalid 404
dmx-on:upload ???
dmx-on:download ???

Paul, not all the dynamic events have corresponding HTTP status codes :slight_smile: as not all of them are related to a response from the server.

Yeah I figured some wouldn’t, but are the ones I have completed already in that list correct, and could I act upon them by setting that as the response.
Just wondering if it even works that way at all, or if it only really applies to success

You can add a custom response status using the set response step in server action, in order to trigger an event.

Do you mean I could add a server connect response on the else step of any random number with a name, and I can then target that in App Connect. So lets say in Server Connect I add a custom response of 299 which does not exist in the real word, and call it customstatus
Can I then add my own event in code of dmx-on:customstatus="anotherscript.load()"

Not really.
You can set a response with a custom name and a status of 299 -that’s right.

But then you don’t call it like dmx-on:customstatus="anotherscript.load()" - you can just check the status code dmx-on:done="serverconnect.status == 299 ? dosomething : dosomethingelse" or eve better - try using flows with conditions inside which check the status.

Example:

Then run the flow on done.

2 Likes

Brilliant, thanks Teo thats exactly what i needed. that makes sense.

Corrected/completed list:

Dynamic Event HTTP Status Code Description
dmx-on:success 200-299 Successful request
dmx-on:start None Start of request
dmx-on:done Any Request finished
dmx-on:error 402,404-599 Failed request
dmx-on:unauthorised 401 Not authorized
dmx-on:forbidden 403 No permissions
dmx-on:abort None Request aborted
dmx-on:invalid 400 Invalid request (validation errror)
dmx-on:upload None Upload progress
dmx-on:download None Download progress
4 Likes

Take a look at this Paul

1 Like

Thanks Brian, I can’t believe I did not find your thread when I searched before asking here again, I hate people that just ask the same questions without searching, so a little disappointed i didn’t find it. Anyway it looks like. between this thread and yours, Teo has also given more insight to your last question of how you could conditionally trigger an event based on the status code returned, so hopefully that helped your understanding a little too.

1 Like