GoEasy

npm install --save [email protected]
import GoEasy from 'goeasy';

//初始化GoEasy对象
//创建全局GoEasy对象
Vue.prototype.$goEasy = new GoEasy({
    host:'hangzhou.goeasy.io', //应用所在的区域地址: 【hangzhou.goeasy.io |singapore.goeasy.io】
    appkey: "my_appkey", //替换为您的应用appkey
    onConnected: function() {
        console.log('连接成功!')
    },
    onDisconnected: function() {
        console.log('连接断开!')
    },
    onConnectFailed: function(error) {
        console.log('连接失败或错误!')
    }
});
______________________________

//接收消息
this.$goEasy.subscribe({
    channel: "my_channel", //替换为您自己的channel
    onMessage: function (message) {
        console.log("Channel:" + message.channel + " content:" + message.content);
    }
});

你可能感兴趣的:(GoEasy)