Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6128593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:38:39+00:00 2026-05-23T16:38:39+00:00

The short question: How do I structure the delivery of multiple push notifications in

  • 0

The short question: How do I structure the delivery of multiple push notifications in PHP? Specifically, how do I “pack” multiple push notification messages into a single fwrite() call?

Can I simply continue to append more messages/payloads to the $apnsMessage string?:

// [connect to service]
// Packing the payload (for a single message)
$apnsMessage = chr(0) . chr(0) . chr(32);
$apnsMessage .= pack('H*', str_replace(' ', '', $recipientToken));
$apnsMessage .= chr(0) . chr(strlen($payload)) . $payload;

// Write the payload to the APNS
fwrite($apns, $apnsMessage);

// [close connection to service]

The long version:

Because Apple requires applications to batch-process push notifications (minimizing several successive connections to their APNS), I’m trying to build something in PHP that can do the job (without using the php-apns lib & memcache). Because 99% of the resources I can find are concerning a single push notification, I was hoping I could find some guidance here. I’m simply adding each message into a mysql table (queue), then every x minutes, iterating through them and sending all the unsent messages.

Does anyone have any examples / links that might help with this approach?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:38:40+00:00Added an answer on May 23, 2026 at 4:38 pm

    Yes, you can simply keep appending messages. The binary protocol format specifically requires strict message lengths so one message can be distinguished from the next in line. Ideally you’d be pushing one long binary string to Apple’s servers all day long.

    Batch processing is not ideal, you’d usually want to implement this as a daemon that keeps an open connection to the APNs servers and writes new messages to the connection as required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short question. How do you go about transposing UML diagrams into code? The class
A short question: I've got a TabNavigator with multiple canvas children. How can i
Short question: How should product categories that appear under multiple categories be managed? Is
Short question: Do any of MS's built in Data Objects support INotifyPropertyChanged? Long explination:
Short question - how do you define your view models? Here are some of
Short question: Is it possible to do a redirection, say when a user isn't
Short question: Is the parent of an entity group included in that entity group
The short question, is there an off the self function to make a graph
very short question. Is C++ typeof operator standard? de facto standard? which compilers do
This is a short question. At some point my thread understand that it should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.