-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting error in sending system notification #425
Comments
Hello, I assume that the issue is related to execution of code - the context. Please refactor your code as we can see that the issue is outside from QuickBlox JavaScript SDK and related to Node implementation. Unfortunately, we do not provide support with Node.js. |
var QuickBlox = require('quickblox').QuickBlox; This is how I have initialized the quickblox. Is this an incorrect way to initialize because I have followed the documentation. Error which I am getting is in quickblox node modules, So I don't think that it's an nodejs issue. |
@sanidhya1712 The init seems to be correct. |
Hi @QB-nikolay-zolotarov , All the sample chat code is from the frontend perspective. We already have a running code on our frontend application but the issue we are facing are on backend side(NodeJs) while send system notification. Do you have any sample of code from backend perspective? |
@sanidhya1712 Hello, unfortunately, we don't have backend (Node.js) samples. As the JS sample works as expected, I assume that the issue is related to the Node.js implementation. Unfortunately, we do not provide support with Node.js. Please review the implementation on your end. |
@QB-nikolay-zolotarov This problem is not about Nodejs. We have written just a piece of javascript code, by referring Quickblox documentation . |
@sanidhya1712 To investigate the issue further, please provide a sample and step-by-step instructions on how to reproduce the issue. |
@QB-nikolay-zolotarov Instruction to run this- |
Im also seeing "TypeError: Cannot read property 'querySelector' of null" after the opponent receives a system message. |
I am using quickblox system notification in my platform for sending live notifications in NodeJs.
First time I try to send live notification, It works perfectly fine but when I try to send notification afterwards, I am getting the following error, even though it send the notification.
TypeError: Cannot read property 'querySelector' of null
at Object.getElementText (/abc/dropN/did/node_modules/quickblox/src/modules/chat/qbChatHelpers.js:123:26)
at ChatProxy._onSystemMessageListener (/abc/dropN/did/node_modules/quickblox/src/modules/chat/qbChat.js:641:42)
at Client. (/abc/dropN/did/node_modules/quickblox/src/modules/chat/qbChat.js:862:30)
at Client.emit (events.js:315:20)
at Client.EventEmitter.emit (domain.js:482:12)
at Client._handleStanza (/abc/dropN/did/node_modules/node-xmpp-client/lib/Client.js:227:12)
at Client.onStanza (/abc/dropN/did/node_modules/node-xmpp-client/lib/Client.js:221:8)
at Connection.emit (events.js:315:20)
at Connection.EventEmitter.emit (domain.js:482:12)
at Connection.onStanza (/abc/dropN/did/node_modules/node-xmpp-core/lib/Connection.js:377:10)
at StreamParser. (/abc/dropN/did/node_modules/node-xmpp-core/lib/Connection.js:231:10)
at StreamParser.emit (events.js:315:20)
at StreamParser.EventEmitter.emit (domain.js:482:12)
at SaxLtx. (/abc/dropN/did/node_modules/@xmpp/streamparser/index.js:69:14)
at SaxLtx.emit (events.js:315:20)
Due to this, my code keeps crashing. Is there any way through which I can prevent this error and send the system notifications seamlessly.
Here is my code through which I am sending these notification.
QB.init(APPLICATION_ID, AUTH_KEY, AUTH_SECRET, ACCOUNT_KEY);
var params = {
userId: 121312,
password: XXXXXYYYYYYY,
};
console.log(params);
QB.createSession({
userId: 121312,
password: XXXXXYYYYYYY,
}, function (err, result1) {
if (err) {
console.log('Something went wrong: ' + JSON.stringify(err));
reject(err)
} else {
console.log("new session created---", JSON.stringify(result1));
QB.chat.connect({
userId: 121312,
password: XXXXXYYYYYYY,
}, async function (error, contactList) {
if (error) {
console.log('not connected to chat', error);
reject(error)
} else {
console.log(error, 'connected to chat', contactList);
var message = {
body: "System_notification",
extension: {
param1: "value1",
param2: "value2",
},
};
var opponentId = 12321321;
try {
message.id = QB.chat.sendSystemMessage(opponentId, message);
console.log("Notification sent", message.id)
resolve("notification sent")
// or message.id = QB.chat.sendSystemMessage(opponentId, message) if message ID is needed
} catch (e) {
if (e.name === "ChatNotConnectedError") {
console.log("not connected")
reject(e)
}
}
}
});
}
});
The text was updated successfully, but these errors were encountered: