How to use the pubnub.OPERATIONS function in pubnub

To help you get started, we’ve selected a few pubnub examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ringcentral / ringcentral-js-widgets / packages / ringcentral-integration / integration-test / mock / pubnub.js View on Github external
mockMessage(msg) {
    const pubnubMsg = {
      channel: this._channels[0],
      subscription: undefined,
      actualChannel: null,
      subscribedChannel: this._channels[0],
      timetoken: '14933652238078468',
      publisher: undefined,
      message: msg,
    };
    this._listeners.forEach((l) => l.message(pubnubMsg));
  }
}

MockedPubNub.OPERATIONS = RealPubnub.OPERATIONS;
MockedPubNub.CATEGORIES = RealPubnub.CATEGORIES;

export function getLastPubnub() {
  return pubnubs[pubnubs.length - 1];
}

function mockPubnub() {
  const id = require.resolve('pubnub');
  if (require.cache[id]) {
    require.cache[id].exports = MockedPubNub;
  }
}

mockPubnub();
github zengfenfei / ringcentral-ts / test / pubnub-mock.ts View on Github external
}

	mockMessage(msg) {
		let pubnubMsg = {
			channel: this.channels[0],
			subscription: undefined,
			actualChannel: null,
			subscribedChannel: this.channels[0],
			timetoken: '14933652238078468',
			publisher: undefined,
			message: msg
		};
		this.listeners.forEach(l => l.message(pubnubMsg));
	}

	static OPERATIONS = RealPubnub.OPERATIONS;
	static CATEGORIES = RealPubnub.CATEGORIES;
}


mockPubnub();


export function getLastPubnub() {
	return pubnubs[pubnubs.length - 1];
}

function mockPubnub() {

	let id = require.resolve('pubnub');
	require.cache[id].exports = MockedPubNub;
}

pubnub

Publish & Subscribe Real-time Messaging with PubNub

SEE LICENSE IN LICENSE
Latest version published 4 days ago

Package Health Score

86 / 100
Full package analysis