简体   繁体   English

如何修复由我的 js 代码引起的 net::ERR_SSL_PROTOCOL_ERROR

[英]How do I fix net::ERR_SSL_PROTOCOL_ERROR caused by my js code

I'm currently having an issue when I call certain function repeatedly (ChartData).当我反复调用某些 function (ChartData) 时,我目前遇到问题。 The code that calls the function is as follows:调用function的代码如下:

  for (let i = 1; i < 3600; i++) {
    setTimeout(function timer() {
      chartserviceApi.ChartData("false").then(responseArr => {
       
        console.log("Here !")
        Chartdata = responseArr.data
        let prpdData = responseArr.data.slice();
        if (Chartdata.length == 0) {
          dataPresent = false;
        }
        if (responseArr.data.find(x => x > 200)) {
          alert('abv 200');
        }

        prpsch1.streamPush(responseArr.data)
        prpdch1.streamPush(prpdData)

        
        const parsedMessage = responseArr.data
        const keys = Object.keys(parsedMessage)
        let dataPackage = parsedMessage[keys[keys.length - 1]]
        console.log(dataPackage)
        //prpsch1.streamPush(dataPackage[0]);
        prpdch1.streamPush(dataPackage[0]);
        prpsch1.consume();
        prpdch1.consume();
        prpsch1.runStream();
        prpdch1.runStream();
      });
    }, 4000);}

The ChartData function is as the following: ChartData function 如下:

import axios from 'axios';
const Chartdata = 0
export default {
  ChartData(param) {
    if (param == "false") {
      console.log("False!")
      return axios.get('https://localhost:3000/api/Sensor/GetSensorDataQ?id=1&isInitiated=false');
    }
    else {
      console.log(param)
      console.log("True!")
      return axios.get('https://localhost:3000/api/Sensor/GetSensorDataQ?id=1&isInitiated=true');
    }
  }

Then I get these errors repeatedly.然后我反复收到这些错误。 在此处输入图像描述

Can anyone suggest what to do here?谁能建议在这里做什么?

Thanks a lot in advance:)提前非常感谢:)

Change https protocol with http in your url.在 url 中使用 http 更改 https 协议。 Because https protocol need ssl certificate.因为 https 协议需要 ssl 证书。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何处理net :: ERR_SSL_PROTOCOL_ERROR? - How to deal with net::ERR_SSL_PROTOCOL_ERROR? socket.io 错误网络::ERR_SSL_PROTOCOL_ERROR - socket.io error net::ERR_SSL_PROTOCOL_ERROR 在 react js 中使用新闻 api 时加载资源失败:net::ERR_SSL_PROTOCOL_ERROR - Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR while using news api in react js 访问不同端口时,js fetch 失败并出现 net::ERR_SSL_PROTOCOL_ERROR - js fetch fails with net::ERR_SSL_PROTOCOL_ERROR when accessing different ports Wordpress - 错误 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL 协议错误 - Wordpress - Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error 具有SSL的Azure辅助角色上的Node.js导致ERR_SSL_PROTOCOL_ERROR - Node.js on Azure Worker Role w/ SSL results in ERR_SSL_PROTOCOL_ERROR 无法登录,我收到 POST http://localhost:5000/auth/login 404 (Not Found) 和 net::ERR_SSL_PROTOCOL_ERROR - Cannot login, and i getting POST http://localhost:5000/auth/login 404 (Not Found) and net::ERR_SSL_PROTOCOL_ERROR 连接建立错误:尝试建立并连接到Websocket服务器时,抛出net :: ERR_SSL_PROTOCOL_ERROR - Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR is thrown when trying establish and connect to a websocket server PHP Websocket 错误:net::ERR_SSL_PROTOCOL_ERROR 使用 cloudflare - PHP Websocket ERROR: net::ERR_SSL_PROTOCOL_ERROR using cloudflare POST https://localhost:5000/stored net::ERR_SSL_PROTOCOL_ERROR - POST https://localhost:5000/stored net::ERR_SSL_PROTOCOL_ERROR
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM