My Remote Web Trigger Stops Working About 30min After Launching Keyboard Maestro

I used this trigger without problems with my older MacBook, but with the new one (M1 max) it doesn't react after about 30min.

Please help.

Thank you,
dave

@peternlewis?

The Remote trigger works with a long poll to a web server on trigger.keyboardmaestro.com. This connection has the “Keep Alive” facility configured to resend periodic empty packets to keep the connection alive. However some networks will lose the connection despite this, and will silently drop the connection but never tell Keyboard Maestro that the connection is dropped.

You can turn on debugging with:

defaults write com.stairways.keyboardmaestro.engine Debug RemoteTriggerMonitor

and restart the Keyboard Maestro Engine, and it will report some information about the connection, but likely nothing very useful.

What you can try is add a second remote trigger, and a system to toggle it on and off every ten minutes (eg every odd ten minutes disable it, and every even ten minutes enable it) - that will force more communication through the pipe and might be enough to ensure the connection stays open.

1 Like

Ok, that seems to work. Thank you very much for the solution.
I done it with integromat. Do you know a better (and cheaper ) way to keep the connection alive?

I don't know what you mean - all you should need to do is have a Keyboard Maestro macro toggle another Keyboard Maestro macro on and off every ten minutes or so. I don't understand how integromat fits in to it.

Ok, Thank you. I didn't think about triggering a trigger Program. Now I tried it with following Macro:

when application activates
will execute following actions:
Repeat actions 100 Times
(open Url in background (a remote trigger without action)
Pause for 6 Minutes)

This works. But I don't like that Safari gets in the foreground every 6 minutes. Have you got a better idea? And why isn't Keyboard Maestro able to keep itself active? Isn't that actually a bug?

Thank you for the help so far.

Hey Dave,

Please take time to actually read the forum – Peter answered your question in post #3.

You don't need a repeat – you can use a Periodic trigger.

You can run JavaScript or AppleScript in a background tab in Safari – it never needs to be brought to the foreground.

-Chris

Hi, Peter.

To try this solution for a macro that loses its remote trigger (Macro 1), would I create a separate macro (Macro 2) with a remote trigger, and a third macro (Macro 3) with a periodic trigger to enable/disable Macro 2, leaving Macro 1 as is?

1 Like

Yes, that sounds right.

Hey @evanfuchs,

Did you develop a macro pair to successfully keep the remote trigger connection open?

If so, is there a macro you can share?

Couldn't a single macro use a periodic trigger to do the work of enabling and disabling the connection?

What I particularly don't understand is how to enable and disable the connection.

Maybe @peternlewis can provide some insight?

Probably the easiest way to force something to happen would be to have a macro group with a lone macro in it that has the remote trigger and does nothing. Then have a globally active macro that triggers every 15(?) minutes, and simply activates and then deactivates that macro group. That should force Keyboard Maestro to send a small amount of data down the connection to say "listen for this", and then another to say "stop listening for this". And hopefully that would be enough to keep the connection data alive thought the entire channel. Adjust the 15 minutes as necessary. Do not make it smaller than a couple minutes as (a) that is unlikely to improve the situation, and (b) that will add unnecessary load to the server.

1 Like

Peter,

Thank you. That was very clear and helpful. I only need it twice a day (morning and evening) so I've started with a macro that already runs every quarter after the hour to activate the group if even hour and disable if odd hour to see if that's enough to ensure the connection is active for my needs.

1 Like

Something like this then?

Apologies for not using the official image upload mechanism - I wanted to be able to cross out my remote trigger ID.