事件和监听器 > 监听GoEasy网络连接状态
 

事件和监听器 - 监听GoEasy网络连接状态

在与GoEasy建立连接的时候,可以注册相应的事件来监听与网络状态相关的事件。错误信息,可根据错误编码参阅附录A

JavaScript连接状态

    goeasy.connect({
        onSuccess: function () {  //连接成功
            console.log("GoEasy connect successfully.") //连接成功
        },
        onFailed: function (error) { //连接失败
            console.log("Failed to connect GoEasy, code:"+error.code+ ",error:"+error.content);
        },
        onProgress:function(attempts) { //连接或自动重连中
            console.log("GoEasy is connecting", attempts);    
        }
    });

JavaScript断开状态

    goeasy.disconnect({
        onSuccess: function(){
            console.log("GoEasy disconnect successfully.")
        },
        onFailed: function(error){
            console.log("Failed to disconnect GoEasy, code:"+error.code+ ",error:"+error.content);
        }
    });

其他相关:

监听GoEasy网络连接状态
监听GoEasy消息发送结果
监听GoEasy channel订阅结果
监听GoEasy channel取消订阅结果

results matching ""

    No results matching ""