How to use the pubnub.publish 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 PubNubDevelopers / Ninja-Multiplayer-Platformer / js / blockscode.js View on Github external
db.get(keyName).then((value) => {
      // console.log('get', keyName, value);
      if (value === null || value.time < request.message.time || true) {
        value = { time: timetoken, coinCache: request.message.coinCache };
        db.set(keyName, value, 1);
        // console.log('set', keyName, value);
      }
       // console.log("value", value);
       // console.log('set', keyName, value);
      // return request.ok();
      pubnub.publish({
        channel: 'realtimephaserFire2',
        message: { value, fromServer: true }
      }).then((publishResponse) => {
        // console.log(publishResponse);
      });
    });
  });

pubnub

Publish & Subscribe Real-time Messaging with PubNub

SEE LICENSE IN LICENSE
Latest version published 5 days ago

Package Health Score

86 / 100
Full package analysis