APNS + PHP"在stream_socket_client():失败,使加密" [英] APNS + PHP "stream_socket_client(): Failed to enable crypto"

查看:315
本文介绍了APNS + PHP"在stream_socket_client():失败,使加密"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用APNS使用PHP和获取以下信息的麻烦:

I'm having trouble with using APNS with PHP and getting the following message:

stream_socket_client(): Failed to enable crypto

问题只发生有时,其他时候它会实际发送推。

The problem only happens sometimes, and other times it would actually send the push.

由于我有10次迭代循环的测试脚本,我有时会得到这样的:

Since I have the test script on a loop of 10 iterations, I would sometimes get this:

stream_socket_client(): SSL: Connection reset by peer

我使用沙盒服务器测试TLS://gateway.sandbox.push.apple.com:2195

下面是我的尝试:


  • 我试图重新发出PEM与它的所有证书。

  • // 和 TLS://
  • 我的请求协议的SSLv3发挥各地
  • 我打得四处口令(推工作没有口令的BTW)

  • 我试了解决方案,并没有寻找工作计算器

  • 经过PEM文件权限 644

  • 经过PEM父目录的权限 755

  • I tried to reissue the PEM and all certificates with it.
  • I played around with the request protocol sslv3:// and tls://.
  • I played around with the passphrase (push worked without the passphrase btw)
  • I tried searching stackoverflow for a solution and nothing worked.
  • Checked pem file permissions 644
  • Checked pem parent directories permissions 755

这一切似乎我在谷歌找到了解决方案,因此也有问题完全推人。

It seems that all the solutions I found on Google and SO are people having problem pushing altogether.

我觉得该服务可能速度的限制?因为我们等了一会儿(大约15分钟),然后再尝试它,并能够成功推约100的消息,直到我开始再次得到这一信息。

I feel like the service is rate limited maybe? Because we waited a while (around 15 minutes) and then tried it again, and was able to successfully push around 100 messages until I started getting that message again.

推荐答案

沙箱推送服务是率受限。测试时我有这个经历我自己,但使用生产API从未遇到过任何这样的限制。

The sandbox push service is rate limited. I have experienced this myself when testing but have never encountered any such limit using the production API.

您也可能会击中他们的其他保护措施。

You might also be hitting their other protections.

您打开一个连接,发送消息,关闭连接,然后循环和做一遍吗?

Are you opening a connection, sending a message, closing connection and then looping and doing it all over again?

这会得到您的通知丢弃。苹果希望你使用相同的连接,而不是每次一个新的派几个推送通知。

That will get your notifications dropped. Apple wants you to send several push notifications using the same connection, not a new one each time.

用于管理连接的最佳实践

您可以建立到同一个网关或多个连接
  多个网关实例。如果你需要发送大量的
  远程通知,S $ P $垫出来到多个连接
  不同的网关。这可以提高性能相比,使用一
  单个连接:它可以让​​你发送远程通知较快,
  它可以让的APN提供他们更快。

You may establish multiple connections to the same gateway or to multiple gateway instances. If you need to send a large number of remote notifications, spread them out over connections to several different gateways. This improves performance compared to using a single connection: it lets you send the remote notifications faster, and it lets APNs deliver them faster.

请与APN的多个通知,打开你的连接;
  不要反复打开和关闭连接。治疗的APN迅速
  连接和断开的拒绝服务攻击。
您应该
  离开连接打开,除非你知道这将是空闲的
  延长时间,例如时期,如果只发送通知
  您的用户每天一次,这是确定用一个新的连接的每一天。

Keep your connections with APNs open across multiple notifications; don’t repeatedly open and close connections. APNs treats rapid connection and disconnection as a denial-of-service attack. You should leave a connection open unless you know it will be idle for an extended period of time—for example, if you only send notifications to your users once a day it is ok to use a new connection each day.

从苹果文档@ <一个href=\"https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html\">https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html

这篇关于APNS + PHP&QUOT;在stream_socket_client():失败,使加密&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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