javascript - Quickblox JS SDK notifyOccupants on dialog creation -
i use code retrieve http://quickblox.com/developers/javascript.
my sdk info: /* quickblox javascript sdk - v2.1.4 - 2016-07-19 */
function notifyoccupants(dialogoccupants, newdialogid) { dialogoccupants.foreach(function(itemoccupanid, i, arr) { if (itemoccupanid != currentuser.id) { var msg = { type: 'chat', extension: { notification_type: 1, _id: newdialogid, }, }; qb.chat.send(itemoccupanid, msg); } }); }
when execute function returning always:
"quickblox.min.js:7 uncaught typeerror: cannot read property 'send' of undefined".
someone can help?
as said in tutorial, have initialize qb object before can use it.
ensure have lines in code:
qb.createsession({login: user.login, password: user.pass}, function(err, res) { if (res) { qb.chat.connect({userid: user.id, password: user.pass}, function(err, roster) {
and check code inside connect
function callback, sure code run after qb initialization.
Comments
Post a Comment