I am updating from pubnub v3 javascript to v4, the publish and subscribe is working, but do not update the database in live... I readed the migration topic here, but I dont understand how, and where I have to integrate the listeners function, I think that is the problem.
var pubnub = new PubNub({
subscribeKey : 'xxx',
publishKey : 'zzz',
ssl: true
});
pubnub.subscribe({
channels : ['my_channel'],
message : function( message, env, channel ){
var getMessage = JSON.stringify(message);
// I readed that I should remove stringify
// to: var getMessage = message;
var obj = jQuery.parseJSON(getMessage);
var data = setInterval(function(){ removeTdBorder(); }, 3000);
... other functions ...
});
and the publish function
function saveToDatabase(editableObj,column,id) {
if(editableObj.tagName == "TD")
{
var editval = editableObj.innerHTML;
}else{
var editval = jQuery('[name="'+column+'"]').val();
}
pubnub.publish({
channel: 'my_channel',
message: {
"message" : editval,
"column" : column,
"id" : id,
},
callback : function(m){
}
});
I have a table component, where I insert data to the cells, with pubnub real time javascript api. I appreciate any help! Thank you in advance!