i've done a apple-mdm-ota-server for IOS so far. The devices deliver me following things to the server (in form of a plist/xml):
-Push Magic Token -Device Token (in b64 format oO) -PN-Topic (com.apple.mgmt.xxx) -UDID (in hexcode) -UnlockToken (a very long b64 encoded thing)
I need to send the following content to the push notification thing from apple:
{"mdm":"pushMagic"}
Pushmagic = the Push Magic Token
How I need to compose the data I need to write into the apns socket? I tried the one that works for other push notifications, but for this it doesn't. There is happening just nothing :-(.
$apns_url = 'gateway.push.apple.com';
[...]
$apns = stream_socket_client('ssl://' . $apns_url . ':' . $apns_port,
$error, $error_string, 2, STREAM_CLIENT_CONNECT, $stream_context);
fwrite($apns, chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ',
'', $wellWrittenToken)) . chr(0) . chr(strlen($mdmInitialPush)) .
$mdmInitialPush);
[...]
$error is 0. $wellwrittentoken = the device-token in hex-code $apns_xx - The ssl thing seems to work, because it gave error message as it didn't $mdminitialpush - my message I want to send