First, you need to obtain the PubNub JavaScript SDK for Node.JS through npm install pubnub or directly via: https://github.com/pubnub/javascript/nodejs/pubnub.js


Second, require the PubNub library in your Node.JS application file: 

var pubnub = require("pubnub")({

    ssl           : true,

    publish_key   : "demo",

    subscribe_key : "demo"

});