发送推送通知从AIR桌面客户端,而中间件(如PHP) [英] Send push notifications from AIR desktop client without middleware (eg. PHP)

查看:215
本文介绍了发送推送通知从AIR桌面客户端,而中间件(如PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过这个PHP code:

With this PHP code:

<?php
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsCert = 'apns-dev.pem';
$apnsPort = 2195;

$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);

$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);

$payload['aps'] = array('alert' => 'Oh hai!', 'badge' => 1, 'sound' => 'default');
$output = json_encode($payload);
$token = pack('H*', str_replace(' ', '', $token))
$apnsMessage = chr(0) . chr(0) . chr(32) . $token . chr(0) . chr(strlen($output)) . $output;
fwrite($apns, $apnsMessage);

socket_close($apns);
fclose($apns);

?>

您可以使用PHP发送推送通知。从AIR桌面客户端,我可以POST变量很容易传递到一个类似code和使用AS3 + PHP来发送通知。

you can send a push notification using PHP. From an AIR desktop client I can easily pass POST variables to a similar code and use AS3+PHP to send a notification.

问题:是理论上可以只使用AS3和AIR(即没有PHP)做的一样吗?有没有人试过?除了防火墙问题,这可能最终会导致出现问题?谢谢。

The question: is it theoretically possible to do the same by only using AS3 and AIR (that is without PHP)? Has anyone tried? Aside from firewall issues, what could eventually cause problems? Thanks.

推荐答案

请原谅我,如果我脱靶这里,但你看ANE的?

Forgive me if I'm off target here, but have you looked at ANE's?

有一个iOS的ANE,看起来像它可以让你从你的手持设备发送本机推不PHP。

There is an iOS ANE that looks like it lets you send a native push from your handheld without php.

http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

这篇关于发送推送通知从AIR桌面客户端,而中间件(如PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆