Question

I could use some help initializing the javascript PubNub interface without having to append divs to the DOM before loading the .js library as recommended by https://pubnub-prod.appspot.com/account-javascript-api-include

I'd like to be able to init PubNub via a function. I tried modifying the solution suggested by this SO question without success: pubnub and head.js

Was it helpful?

Solution

Phil from PubNub here. We've got you covered. All you have to do is use the following code:

var pubnub = PUBNUB.init({
    publish_key   : my_publish_key,
    subscribe_key : my_subscribe_key,
    ssl           : false,
    origin        : 'pubsub.pubnub.com'
});

Hope this solves your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top