METACHAOS

METACHAOS

In fact the bodies represented in METACHAOS, even though they are characterized by an apparently anthropomorphous appearance, in reality they are without identity and conscience. They exist confined in a spaceless and timeless state, an hostile and decadent hyperuranium where a fortress, in perpetual movement, dominates the landscape in defense of a supercelestial, harmonic but fragile parallel dimension. In its destructive instinct of violating the dimensional limbo, the mutant horde penetrates the intimacy of the fortress, laying siege like a virus. Similar to the balance of a philological continuum in human species, bringing the status of things back to the primordial broth.

So that explains it, then.

Previously, previously, previously.
Tags: , , , ,

Emoji Meme: Buy, Sell, Trade. Missed Connection Repairs. Psychic Tax Readings.

Previously.

Tags: ,

Apple Pass push notifications

Dear lazyweb, how do I send Apple Pass push notifications?

Yesterday I added Apple Wallet passes to the DNA Lounge ticketing system: now when you buy a ticket, the confirmation email comes with an attachment that will dump the ticket into your phone such that it will automatically pop up on your lock screen when you are in physical proximity of the club on the day of the event. It's kinda neat.

What I haven't figured out is how to send push notifications.

When someone adds the pass to their phone, their phone registers with my server, sending it the device ID, the serial number of the pass, and a "pushToken". I should be able to take this info and tell Apple, "tell the device to re-download the pass from my server".

The Binary Provider API document explains how to pack up a request to ship off to Apple. The "device ID" is a 32-digit hex number, meaning a 16-byte value; and the "pushToken" is a 64-digit hex number, meaning a 32-byte value, so I assume that when that doc says "32 byte device token" it means the "pushToken" and not the "device ID".

So I'm packing it up like this, and getting neither an error message back, nor a return connection from the phone. What am I missing?

    $note_id = time();
    $expires = time() + (60 * 60 * 24);
    $payload = "{}";

    // Decode the 64-digit hex string to a 32-byte number.
    $push_token = pack ('H*', $push_token);

    $items = (chr(1) .        // ID 1 = device token
              pack('n', strlen($push_token)) .
              $push_token .

              chr(2) .        // ID 2 = payload
              pack('n', strlen($payload)) .
              $payload .

              chr(3) .        // ID 3 = notification ID
              pack('n', 4) .
              pack('N', $note_id) .

              chr(4) .        // ID 4 = expiration date
              pack('n', 4) .
              pack('N', $expires) .

              chr(5) .        // ID 5 = priority
              pack('n', 1) .
              chr(10));

    $cmd = (chr(2) .          // Command = 2
            pack ('N', strlen($items)) .
            $items);
    ...
    stream_context_set_option ($ctx, 'ssl', 'local_cert', $CERT_FILE);
    $fp = stream_socket_client ('ssl://gateway.push.apple.com:2195', ...

Please do not answer with "pay some third-party web service to do this for you" or "install this multi-gigabyte black-box framework".

Update: Got it working, woo...

Tags: , , ,

  • Previously