Created
October 12, 2020 20:03
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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