RequireJS

Integrate goeasy.js

Add goeasy.js download path into the requirejs config.

requirejs.config({
    paths: {
        goeasy: 'https://cdn.goeasy.io/goeasy-1.0.3.js'
    }
});

Example

requirejs(['goeasy'],  function(GoEasy) {
    // Initialize GoEasy
    var 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
    goEasy.subscribe({
        channel: "my_channel", //Replace it with your own channel
        onMessage: function (message) {
            console.log("Channel:" + message.channel + " content:" + message.content);
        }
    });

    // Publish messages
    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 ""