HTML

Integrate goeasy.js

Import goeasy.js into your html.

<!--[if lte IE 8]>//if you need to support lower versions than IE8
<script  type="text/javascript" src="https://cdn.goeasy.io/json2.js"></script>
<![endif]-->

<script type="text/javascript" src="https://cdn.goeasy.io/goeasy-1.0.3.js"></script>

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
});
//GoEasy-OTP is used to secure your appkey, more details see 
//If you need to use HTTPS/WSS, please add the option 'forceTLS' and set it to be true

GoEasy-OTP

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
});

Cancel Subscription

    goEasy.unsubscribe ({
        channel: "my_channel" //Replace it with your own channel
    });

results matching ""

    No results matching ""