Tag: pushsharp

如何使用PushSharp在GCM中发送批处理通知

正如标题所示,我有一份所有注册ID的列表,我希望立即向所有注册ID发送相同的消息。 我被告知GCM可以同时处理大约1000个通知,但我真的很困惑如何在PushSharp执行此PushSharp (除了实际使用for循环实际发送它们)。 如果有人熟悉这一点,我真的很感激一些帮助。 他是一些通用代码 push.RegisterGcmService(new GcmPushChannelSettings(ApiKey)); push.QueueNotification(new GcmNotification().ForDeviceRegistrationId(RegistrationID) .WithJson(json)); 而不是有1个注册ID,我想发送它们的列表。 参考常见问题解答,但没有关于如何做到这一点的实际答案。 参考1 参考2 参考3

在PushSharp 4.0中构建GCM消息

我有点困惑的是我应该如何构建使用PushSharp的GCM推送通知的消息体。 GitHub仓库中的文档和测试文件显示了看起来像消息结构的内容: broker.QueueNotification (new GcmNotification { RegistrationIds = new List { regId }, Data = JObject.Parse (“{ \”somekey\” : \”somevalue\” }”) }); 我一直在使用Postman进行测试,我将以下JSON格式的消息发送到https://gcm-http.googleapis.com/gcm/send 。 { “to”: “000-0000-mytoken-foo”, “notification” : { “title” : “Push Test Notification”, “body” : “GCM Test Push”, “icon” : “icon”, “color” : “#FF4081” } } 消息的’to’和’notification’部分是否已由框架处理? 基于我看到的示例,似乎我只需要输入通知对象的键:值对,但我似乎无法找到文档的位置或文档中实际消息的示例。 我正在使用PushSharp的最新版本(4.x)。

PushSharp不会发送通知

我有一个简单的代码: PushBroker pushBroker = new PushBroker(); string path = HttpContext.Current.Server.MapPath(“~/” + AppSettings.CertificatePath); var appleCert = File.ReadAllBytes(path); pushBroker.RegisterAppleService( new ApplePushChannelSettings(AppSettings.IsProductionPushNotificationServer, appleCert, AppSettings.CertificatePassword)); var notification = new AppleNotification().ForDeviceToken(deviceToken.TrimStart(”)) .WithBadge(unviewedInvitationCount); pushBroker.QueueNotification(notification); 我尝试分别使用Sandbox和Production服务器的开发和生产sertificates。 但什么都没发生。 客户端能够获得推送通知。 怎么了? 提前致谢。 更新: 我订阅了这些活动。 OnNotificationFailed告诉我有关此错误的信息: {APNS NotificationFailureException -> 5 : Invalid token size -> {“aps”:{“badge”:1}}} 如果我将设备令牌包装到中,我会收到另一个错误: {APNS NotificationFailureException -> 8 : Invalid token -> […]

PushSharp Apple – 收到的消息是意外的或格式错误

我使用的是PushSharp 2.1.2版。 该应用程序是.NET 4.5.1(虽然我也尝试过针对.NET 4.5和.NET 4) 我正在尝试但没有成功通过沙盒Apple APNS发送推送消息。 我使用相同的证书并使用与我的PushSharp应用程序相同的设备ID,使用Ray Wenderlich演练中提供的PHP脚本成功发送消息。 我已通过从钥匙链中导出已完成的证书p12进行测试。 导出已完成的证书和密钥。 导出私钥。 也可以通过这里使用的方法。 当我将证书和密钥结合起来用于PHP脚本时,我没有任何问题。 我已将p12证书导入到我测试过的机器上 – 似乎没有任何区别。 我已经尝试在向推送代理注册apple推送服务时更改IsProduction标志。 将它设置为生产时没有错误(即使这是一个沙箱证书),但在这种情况下它显然也无法通过设备。 我的所有消息都不会通过,所有消息都会得到如下所示的服务exception: System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. —> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted — End of inner exception stack trace — at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception) […]