推送通知服务器实施 [英] Push notifications server implementation

查看:55
本文介绍了推送通知服务器实施的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的服务器(具有专用IP和2195端口的tcp和udp开放端口的Bluehost)上使apns-php(http://code.google.com/p/apns-php/)工作.

I'm trying to make work apns-php (http://code.google.com/p/apns-php/) on my server (Bluehost with dedicated IP and port 2195 open for tcp and udp outgoing).

我收到此错误:

致命错误:未捕获的异常 带有消息的"ApnsPHP_Exception" '无法连接到 'ssl://gateway.sandbox.push.apple.com:2195': (0)'在 /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php:352 堆栈跟踪:#0 /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php(295): ApnsPHP_Abstract-> _ connect()#1 /home2/xxxxx/public_html/xxxxx/pns/sample_push.php(41): ApnsPHP_Abstract-> connect()#2 {main} 扔进去 /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php 在第352行

Fatal error: Uncaught exception 'ApnsPHP_Exception' with message 'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)' in /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php:352 Stack trace: #0 /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php(295): ApnsPHP_Abstract->_connect() #1 /home2/xxxxx/public_html/xxxxx/pns/sample_push.php(41): ApnsPHP_Abstract->connect() #2 {main} thrown in /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php on line 352

我已经与Bluehost支持人员联系,他们告诉我:

I have contact Bluehost support and they told me this:

感谢您与我们联系.如果好像 虽然服务器 ssl://gateway.sandbox.push.apple.com:2195 * 拒绝接受连接 由您的帐户制成.有办法吗 您可以将专用IP列入白名单,或者 接受他们的传入连接 结束吗?

Thanks for contacting us. If seems as though the server ssl://gateway.sandbox.push.apple.com:2195* is refusing to accept the connection made from your account. Is there a way you can whitelist your dedicated ip or accept incoming connections on their end?

有人可以帮助我解决这个问题吗?有任何想法吗?谢谢!

Someone can help me to solve this out? Any ideas? Thanks!

推荐答案

我找到了一个解决方案,我不知道它是否是最好的,但是它可以工作.在Abstract.php(此文件是apns-php源代码的一部分)上,我已经注释了第343行.现在看起来像这样:

I have found a solution, I don't know if it's the best, but it works. On Abstract.php (this file is part of the apns-php source) I have commented the line 343. Now it looks like this:

$streamContext = stream_context_create(array('ssl' => array(
//'verify_peer' => isset($this->_sRootCertificationAuthorityFile),
'cafile' => $this->_sRootCertificationAuthorityFile,
'local_cert' => $this->_sProviderCertificateFile
)));

我真的不知道这行的意义,但是知道推送通知工作正常.我怀疑它在生产服务器上是否也能正常工作.有人知道吗?

I really don't know what is the point of this line, but know the push notification is working properly. My doubt is if it will work properly too on production server. Someone knows?

这篇关于推送通知服务器实施的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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