guness / node-xcs Goto Github PK
View Code? Open in Web Editor NEWNodeJS implementation of Google's XMPP Connection Server
License: BSD 2-Clause "Simplified" License
NodeJS implementation of Google's XMPP Connection Server
License: BSD 2-Clause "Simplified" License
There are new versions up to 0.13.0 which are not getting installed.
(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)
When having network problems, I received this Warning, though when network had recovered the connection restored without problems.
on "line 362", I'm periodically sending testing messages to FCM just to check connection:
// проверка соединения с 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);
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
I would like to send message from device to the app server.
{"message_id":5634438218616813911}
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.
After some time upstream messages do not arrive (after night in the morning)
Where should I use this module. In a node server?
Can you please confirm the library correctly receives receipts?
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>);
Icon is required currently, but is not required for notifications being forwarded through firebase to APN
Hello,
This module depends on [email protected] which is deprecated. Further more, node-xmpp-client depends on request module which has memory leak issue in versions < 2.85.0
(request/request#2938 )
This means that until direct dependencies of this module are updated, this module has a reported memory leak.
Thank you
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.
The callback is never called although the server does emit the "connected" event on startup
Works fine with 11, but with 12, 13 does not connect...
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
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.
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?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.