env('PUSHER.INSTANCE_ID'), "secretKey" => env('PUSHER.SECRET_KEY'), ) ); return $beamsClient->publishToInterests( $interest, // 兴趣名称最多100个 [ "apns" => [ "aps" => [ "alert" => [ "title" => $title, "body" => $body ] ] ], "fcm" => [ "notification" => [ "title" => $title, "body" => $body ] ], "web" => [ "notification" => [ "title" => $title, "body" => $body ] ] ] ); } // 发送到指定用户, 用户列表必须是数组,最大长度1000个用户 public function publishToUsers($userArr, $title, $body) { $beamsClient = new \Pusher\PushNotifications\PushNotifications( array( "instanceId" => env('PUSHER.INSTANCE_ID'), "secretKey" => env('PUSHER.SECRET_KEY'), ) ); return $beamsClient->publishToUsers( // array("user-001", "user-002"), $userArr, array( "fcm" => array( "notification" => array( "title" => $title, "body" => $body ) ), "apns" => array("aps" => array( "alert" => array( "title" => $title, "body" => $body ) )), "web" => array( "notification" => array( "title" => $title, "body" => $body ) ) ) ); } }