[API suggestion] "Keep alive" command/argument
Posted: Sat Mar 03, 2012 6:31 pm
In languages like PHP, where the application must explicitly start to listen to the server and fail if it receives nothing in a certain timeout, using commands like "listen" can cause the connection to break unless listen produces something in the timeout interval.
To remedy this problem currently, clients need to send a continious ping command to keep the connection busy while they "listen". This however entails an unnecesary performance penalty, since the ping itself isn't really necessary - any data would do, as long as it is available within the timeout interval.
A more efficient solution would be to have a dedicated command that sends an empty !re reply at a certain specified interval OR if the listen command does that if an optional argument with an interval is specified (since the listen command is really where the problem is). Personally, I'd prefer the latter, but I'll be happy with the first too.
e.g.
would return (after 4s, if nothing happens during that time):
or if something (in this case a deleted item) has happened within that time:
To remedy this problem currently, clients need to send a continious ping command to keep the connection busy while they "listen". This however entails an unnecesary performance penalty, since the ping itself isn't really necessary - any data would do, as long as it is available within the timeout interval.
A more efficient solution would be to have a dedicated command that sends an empty !re reply at a certain specified interval OR if the listen command does that if an optional argument with an interval is specified (since the listen command is really where the problem is). Personally, I'd prefer the latter, but I'll be happy with the first too.
e.g.
Code: Select all
/ip/arp/listen
.tag=arp
=keep-alive-interval=2s
Code: Select all
!re
.tag=arp
!re
.tag=arp
Code: Select all
!re
.tag=arp
!re
.tag=arp
=.id=*68
=.dead=yes
!re
.tag=arp