Node.js 某些客户端浏览器中的MQTT连接超时
在某些客户端浏览器中,mqtt未连接。已连接websocket连接。Node.js 某些客户端浏览器中的MQTT连接超时,node.js,websocket,mqtt,Node.js,Websocket,Mqtt,在某些客户端浏览器中,mqtt未连接。已连接websocket连接。 我正在使用hivemq mqttws31.js文件。请帮帮我。我已经解决了这个问题。实际问题是客户端avast反病毒。Avast正在阻止80端口。在取消阻止80端口后,它将正常工作。因此,请更改80以外的端口号,以便每个用户都可以从任何浏览器连接,并且没有反病毒会阻止该端口。关于哪些浏览器(如Firefox、Chrome…)的一些信息可能会在此处有所帮助。还显示keepAlive是否比超时值长?在所有浏览器(即Firefox、
我正在使用hivemq mqttws31.js文件。请帮帮我。我已经解决了这个问题。实际问题是客户端avast反病毒。Avast正在阻止80端口。在取消阻止80端口后,它将正常工作。因此,请更改80以外的端口号,以便每个用户都可以从任何浏览器连接,并且没有反病毒会阻止该端口。关于哪些浏览器(如Firefox、Chrome…)的一些信息可能会在此处有所帮助。还显示keepAlive是否比超时值长?在所有浏览器(即Firefox、Chrome)中都不连接。是否可以粘贴更多代码?你真的调用了connect方法吗?您在浏览器开发控制台中看到什么了吗?
var myhost="some ip";
var myport="80";
var websocketclient = {
'client': null,
'connect': function ()
{
var host =myhost;
var port = myport;
clientId = 'clientId-' + randomString(10);
var keepAlive = 60;
this.client = new Messaging.Client(host,port, clientId);
this.client.onConnectionLost = this.onConnectionLost;
this.client.onMessageArrived = this.onMessageArrived;
var options = {
timeout: 30, //seconds
keepAliveInterval: keepAlive,
onSuccess: this.onConnect,
onFailure: this.onFail
};
if (username.length > 0 && password.length > 0){
options.userName = username;
options.password = password;
this.client.connect(options);
}
}};