Skip to content

Instantly share code, notes, and snippets.

@digitallysavvy
Created October 12, 2020 20:03
Show Gist options
  • Save digitallysavvy/a418144b2b61547701cdf96cdf97abee to your computer and use it in GitHub Desktop.
Save digitallysavvy/a418144b2b61547701cdf96cdf97abee to your computer and use it in GitHub Desktop.
a function that uses a PubNub client to send a message into a PubNub channel.
function publishMessage(message, callback) {
var msgConfig = {
channel : channelName,
sendByPost: true,
message: {
uuid: UID,
title: "text",
description: message
}
}
pubNub.publish(msgConfig, function(status, response) {
console.log(status, response);
if (callback != undefined && callback instanceof Function) {
callback();
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment