Giter VIP home page Giter VIP logo

node-xcs's Issues

EventEmitter memory leak.

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at Client.addListener (events.js:160:15)
at Client.Session._addConnectionListeners (D:\nodeWorkspace\firstProject\nod e_modules\node-xmpp-client\lib\session.js:178:10)
at Client.Session._setupSocketConnection (D:\nodeWorkspace\firstProject\node _modules\node-xmpp-client\lib\session.js:49:8)
at Client.Session (D:\nodeWorkspace\firstProject\node_modules\node-xmpp-clie nt\lib\session.js:27:10) at Client._useStandardConnect (D:\nodeWorkspace\firstProject\node_modules\no de-xmpp-client\lib\Client.js:152:11)
at Client.connect (D:\nodeWorkspace\firstProject\node_modules\node-xmpp-clie nt\lib\Client.js:137:8) at Client. (D:\nodeWorkspace\firstProject\node_modules\node-xcs\g oogle\Sender.js:54:25)
at Client.emit (events.js:92:17)
at Connection.emit (events.js:92:17)
at Connection.onClose (D:\nodeWorkspace\firstProject\node_modules\node-xmpp- core\lib\Connection.js:424:10)
at CleartextStream.emit (events.js:117:20)
at tls.js:693:10
at process._tickCallback (node.js:419:13)

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null

When having network problems, I received this Warning, though when network had recovered the connection restored without problems.

image

on "line 362", I'm periodically sending testing messages to FCM just to check connection:

image

// проверка соединения с FCM:
setInterval(function () {
    let from = "111222333";
    let message = new Message(from + "_ack").priority("high").dryRun(true)
        .addData("messageId", from)
        .deliveryReceiptRequested(true)
        .build();

    logger.info('Check connection... ' + new Date());

    xcs.sendNoRetry(message, from, function (result) {
        if (result.getError()) {
            if (result.getError() === 'BAD_REGISTRATION')
                logger.info("Check connection ok");
            else
                logger.error("Check connection ERROR! " + result.getError());
        } else {
            logger.info(`Check connection ${senderXcs.name} message sent: #` + result.getMessageId());
        }
    }); // Messages received from client (excluding receipts)

}, 120000);

exception on xcs.start after updating to 0.1.8

windows 10, node 14.18.1

var xcs = new Sender(...)

xcs.start();

TypeError: this.client.socket.setTimeout is not a function
at Sender.start (C:...\FCM_XMPPServer\node_modules\node-xcs\google\Sender.js:146:24)
at Object. (C:...\FCM_XMPPServer\Index.js:424:7)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47

Can not receive message

I would like to send message from device to the app server.

  1. I run the following command to send a message to Firebase and it is successful with a valid message id:
    curl -X POST --header "Authorization: key=" --header "Content-Type: application/json" ht-d "{"to":"/topics/foo-bar","notification":{"body": "HEY YO"}}"

{"message_id":5634438218616813911}

  1. But when I run the node code in server with the right configuration:

xcs.on('message', function(messageId, from, data, category) {
console.log('received message', data);
});

There is no message in the console.

Please advise what I am missing.

Allow selection for FCM testing port 5236

Is it possible to add an argument to Sender object to specify the port 5236 for testing and development purposes instead of using port 5235 which should be only used for production.

Something like

// Production
fcm-xmpp.googleapis.com:5235

// Testing
fcm-xmpp.googleapis.com:5236

var xcs = new Sender(<server id>, <server key>, <boolean isProduction>);

No option to set XMPP connection to reconnect

Hello,
I believe that there is one issue with the current implementation, related to the possibility to reconnect to the FCM server in case of lost of connection.
The xmpp-node library has an option to pass a parameter { reconnect: true} to attempt to reconnect the WebSocket, in case the connection is lost. This is very important for the reliability of the Push Notifications, in the case your server recover from a network loss.
The simple solution would be to add this to the parameter passed to Sender(), but I think the best solution, to be as generic as possible, is to change the Sender to accept a configuration object, where you can set the current values, plus some extra values, as for example the reconnect on the xmpp.Client.

XMPP authentication failure

When i run the example on my own pc I get 'XMPP authentication failure'.
I give my SenderID, ServerKey to 'Sender' but getting the exception.
Why I cant run it on my pc?
Do I need a NodeJS server with https? Thank you

Node upgrade (12) brokes connection start

Since I've upgraded to node 12.18.2 the xmpp connection doesn't start itself as the doc says.
I had to upgrade the library from 0.1.5 version to 0.1.7 and add xcs.start() just after the import.

No "xcs.start()" is present in README.

Consider updating docs to use senderId rather than projectId

I think it's worth considering updating at least the README to use senderId rather than projectId. I for one ran into an initial configuration issue by attempting to create a new sender with my GCP project ID instead of the GCM sender ID - didn't notice the discrepancy until I took a look at the GCM reference docs. Would you accept a quick PR for this?

Sender._send fails due to API change in node-xmpp-client v3.0.1

Hi,

I get an error thrown as soon as I receive an upstream message:

/Users/daniel/project-dir/node_modules/node-xcs/google/Sender.js:128
        var message = new xmpp.Stanza.Element('message').c('gcm', {xmlns: 'google:mobile:data'}).t(JSON.stringify(json));
                      ^

TypeError: xmpp.Stanza.Element is not a function
    at Sender._send (/Users/daniel/project-dir/node_modules/node-xcs/google/Sender.js:128:23)

Looked into this a bit and node-xmpp-client released version 3.0.1 about a week ago and gets installed by node-xcs due to the ^3.0.0 glob. When I pin the node-xmpp-client dep specifically at 3.0.0 I don't get this error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.