0

我正在尝试通过Node.js 中的 UnifiedPushServer向我的 android 设备发送消息。

我试过了:

var agSender = require( "unifiedpush-node-sender" ).AeroGear,
    url = "http://192.168.1.9:8080/ag-push",message="Hello";


settings = {
    applicationID: "8f39bc13-acb7-4d34-baa1-c2343f8ebff4",
    masterSecret: "2a1a901a-34f7-40c9-b6d0-50129c4794ae"    
};

agSender.Sender(url).send(message, settings ).on( "success", function( response ) {
    console.log( "success called", response );
}).on("error",function(error){
    console.log(error);
});

并开始运行我得到的代码:

D:\node>node server.js

events.js:74
        throw TypeError('Uncaught, unspecified "error" event.');
              ^
TypeError: Uncaught, unspecified "error" event.
    at TypeError (<anonymous>)
    at emit (events.js:74:15)
    at doEvent (D:\node\node_modules\unifiedpush-node-sender\lib\unifiedpush-nod
e-sender.js:25:14)
    at ClientRequest.<anonymous> (D:\node\node_modules\unifiedpush-node-sender\l
ib\unifiedpush-node-sender.js:44:25)
    at ClientRequest.g (events.js:180:16)
    at ClientRequest.emit (events.js:95:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1692:21)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23
)
    at Socket.socketOnData [as ondata] (http.js:1587:20)
    at TCP.onread (net.js:527:27)

可能是什么问题呢?

4

1 回答 1

0

你不再需要.AeroGear这里了

var agSender = require( "unifiedpush-node-sender" ).AeroGear

于 2014-09-22T17:01:34.947 回答