AngularJS

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
export default {
    goEasy: null
}

Import global.js into main.ts.

import g from './global.js';

//initialize GoEasy
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) {
        alert("Channel:" + message.channel + " content:" + message.content);
    }
});

Publish messages

import g from './global.js';

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 ""