Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor({ subscribeKey }) {
this._subscribeKey = subscribeKey;
this._realPubnub = new RealPubnub({ subscribeKey });
this.encrypt = this._realPubnub.encrypt;
this.decrypt = this._realPubnub.decrypt;
this._channels = [];
this._listeners = [];
pubnubs.push(this);
}
function PubSub() {
const pubnub = new PubNub(pubnubConfig);
pubnub.subscribe({ channels: [MESSAGE_CHANNEL] });
this.addListener = listenerConfig => {
pubnub.addListener(listenerConfig);
}
this.publish = message => {
console.log('publish message', message);
pubnub.publish({
message,
channel: MESSAGE_CHANNEL
});
}
}
authorize () {
if (process.env.REACT_APP_PUBNUB_PUBLISH_KEY && process.env.REACT_APP_PUBNUB_SUBSCRIBE_KEY) {
this.pubnub = new PubNub({
publishKey: process.env.REACT_APP_PUBNUB_PUBLISH_KEY,
subscribeKey: process.env.REACT_APP_PUBNUB_SUBSCRIBE_KEY,
authKey: process.env.REACT_APP_PUBNUB_AUTH_KEY,
ssl: true
})
}
}
load(callback) {
if (this._loading) {
return;
}
this._loading = true;
this._callback = callback;
this._tweets = [];
this._stream = new PubNub({
subscribeKey: 'sub-c-78806dd4-42a6-11e4-aed8-02ee2ddab7fe',
});
this._stream.addListener({ message: this._message });
this._stream.subscribe({ channels: ['pubnub-twitter'] });
}
import PubNub from 'pubnub'
const pubnub: any = new PubNub({
publishKey: '',
subscribeKey: '',
subscribeRequestTimeout: 60000,
presenceTimeout: 122
})
export default pubnub
() => {
this.disconnectWebsockets();
this.pubnub = new PubNub({
subscribeKey: SUB_KEY,
publishKey: PUB_KEY,
cipherKey,
ssl: true
});
this.channelName = channelName;
this.cipherKey = cipherKey;
resolve();
}
);
constructor() {
this.pubnub = new PubNub(pubnubConfig);
this.pubnub.subscribe({ channels: [MESSAGE_CHANNEL] });
}