node.js - 收到新订阅者时 rs/pushd 崩溃

标签 node.js push-notification redis

我正在尝试使用 https://github.com/rs/pushd 作为推送通知服务器。

每当我尝试添加新订阅者时,服务器都会崩溃并显示以下堆栈跟踪:

/home/ec2-user/push_server/pushd/node_modules/redis/index.js:602
                throw err;
                      ^
TypeError: Cannot set property 'id' of null
  at /home/ec2-user/push_server/pushd/lib/api.coffee:20:21
  at /home/ec2-user/push_server/pushd/lib/subscriber.coffee:133:21
  at try_callback (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:592:9)
  at RedisClient.return_reply (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:685:13)
  at HiredisReplyParser.<anonymous> (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:321:14)
  at HiredisReplyParser.emit (events.js:95:17)
  at HiredisReplyParser.execute (/home/ec2-user/push_server/pushd/node_modules/redis/lib/parser/hiredis.js:43:18)
  at RedisClient.on_data (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:547:27)
  at Socket.<anonymous> (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:102:14)
  at Socket.emit (events.js:95:17)
  at Socket.<anonymous> (_stream_readable.js:765:14)
  at Socket.emit (events.js:92:17)
  at emitReadable_ (_stream_readable.js:427:10)
  at emitReadable (_stream_readable.js:423:5)
  at readableAddChunk (_stream_readable.js:166:9)
  at Socket.Readable.push (_stream_readable.js:128:10)
  at TCP.onread (net.js:529:21)

这是应该添加新订阅者的命令(来自文档的示例),并导致崩溃:

curl -d proto=apns -d token=FE66489F304DC75B8D6E8200DFF8A456E8DAEACEC428B427E9518741C92C6660 -d lang=fr -d badge=0 -d category=show -d contentAvailable=true http://localhost/subscribers

崩溃发生在订阅者被添加到数据库之前。

服务器是 AWS 上的 RHEL 微型实例

版本

Redis 服务器 2.8.19。

Node.js 0.10.36。

CoffeeScript 1.9.0

我们将不胜感激。

最佳答案

/lib/event.coffee
-        throw new Error("Missing redis connection") if not redis?
+        throw new Error("Missing redis connection") if not @redis?
/lib/subscriber.coffee
-                if info?.updated? # subscriber exists
+                if @info?.updated? # subscriber exists
                     # transform numeric value to number type
-                    for own key, value of info
+                    for own key, value of @info

关于node.js - 收到新订阅者时 rs/pushd 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28350831/

相关文章:

javascript - 如何排除 Firebase 数据库树中的某些键

node.js - 如何在 NodeJS 服务器上使用 mongoose 进行同步查询

javascript - TypeScript 中的 Soap 请求

node.js - Node js 中的 Google Drive 文件下载 api 无法工作?

android - BroadcastReceiver 永远不会使用 GCM 服务调用

php - 如何在通知中心向特定用户发送推送通知?

asp.net - 多个站点的正确缓存架构

c# - ServiceStack Redis在检索数据时是如何发挥作用的

swift - 在 Swift 中更新 TabBar Badge 无法转换 UINavigationController 类型的值

javascript - socket.io 客户端在长 Node.js 函数中自动断开连接