React Native

Initialize GoEasy

Integrate goeasy.js sdk.
Create a global.js file to store global data, and put it into the root directory of your project.

//global.js example
export default {
    goEasy: null
}

Import global.js into your index.js.

import g from './global.js'

// Initialize global GoEasy in index.js file 
g.goEasy = new GoEasy({
    host: "hangzhou.goeasy.io", //your application region: [hangzhou.goeasy.io |singapore.goeasy.io]
    appkey: "my_appkey" //Replace it with your own appkey
});

Receive messages

import g from './global.js';

g.goEasy.subscribe({
  channel: "my_channel", //Replace it with your own channel
  onMessage: function (message) {
      console.log(message.content);
  }
});

Publish messages

import g from './global.js';

g.goEasy.publish({
  channel: "my_channel", //Replace it with your own channel
  message: "Hello, GoEasy!" //Replace it with your own message
});

results matching ""

    No results matching ""