hook
hook
The WordPress hook name ("tag").
Class to schedule, poll, and forward messages over IMAP to an SMS.
getNextRunTime(integer $backoff_step) : integer
Determines when the next run should be.
This is implemented by providing a "back-off timer" value as a counter beginning from 0. When 0 is passed, the back-off value is equal to the time step. Otherwise, the counter is multiplied by a multiplier (usually 2).
This creates the following situation when the time step is 30 seconds and the multiplier value is 2:
Run number 1, back-off counter 0, next run in 30 seconds
Run number 2, back-off counter 1, next run in 1 minute
Run number 3, back-off counter 2, next run in 2 minutes
Run number 4, back-off counter 4, next run in 4 minutes
Run number 5, back-off counter 8, next run in 8 minutes
Total elapsed time for five runs is 15 minutes and 30 seconds. When message activity is detected, we reset the counter to 0.
This algorithm helps ensure we don't overload the remote server but still lets us detect the presence and then forward messages relatively quickly when an active conversation is taking place.
The algorithm above is similar to TCP's adaptive retransmission algorithm. (Research that algorithm for more insight on this.)
integer | $backoff_step |
forward(\WP_Buoy_SMS $SMS, string $text, array<mixed,\WP_Buoy_User> $recipients, \WP_Buoy_User $sender, array<mixed,string> $headers = array())
Forwards a text message to a set of recipients.
\WP_Buoy_SMS | $SMS | The |
string | $text | |
array<mixed,\WP_Buoy_User> | $recipients | |
\WP_Buoy_User | $sender | |
array<mixed,string> | $headers | Extra headers to set. |