一号通知延迟



我有一个在Android上运行的Ionic 2应用程序,上面有一个wordpress网站提供数据。我有使用一个信号的通知。问题是通知在更新其余 API 数据之前到达。该应用程序最多可能需要一分钟才能更新。有没有办法延迟一个信号通知?或者加快WordPress的json数据?

我正在寻找同样的东西。稍微修改了一下您的代码,它工作正常。

// Send OneSignal Push after some time delay.
add_filter('onesignal_send_notification', 'onesignal_delay_send', 10, 4);
function onesignal_delay_send($fields, $new_status, $old_status, $post) {
    //delay
    $delay = '+25 minutes';
    //replace it with your timezone. Mine is UTC+05:30
    $timezone = 0530;
    
    $current_time = current_time('M d Y H:i:s e+$timezone');
    $future_time = date( 'M d Y H:i:s e+$timezone', strtotime( $delay, strtotime( $current_time ) ) );
  
    // Schedule the notification to be sent in the future
    $fields['send_after'] = $future_time;
  
    return $fields;
}

你可能无法加快wp json数据的速度,有一些改进的空间(以毫秒为单位),但没什么......只是需要时间。

如果你有编程知识,我会推荐这个:

  • 覆盖该插件,删除为通知传递而发生的调用。
  • 创建您自己的插件/代码
  • ,该插件/代码仅在 WP JSON 数据(成功)运行时运行通知传递代码。

我知道这没有多大帮助,但是... :)

最新更新