【问题标题】:InValid Frame header on Websocket using node.js使用node.js的Websocket上的无效帧头
【发布时间】:2018-09-18 11:09:16
【问题描述】:

我的 chrome 控制台出现以下错误。

websocket.js:111 WebSocket 连接到“ws://c7f2053b.ngrok.io/socket.io/?EIO=3&transport=websocket”失败:帧头无效

在我的 Firefox 中我得到了这个

与 ws://c7f2053b.ngrok.io/socket.io/?EIO=3&transport=websocket&sid=h1U3iQ9b3INSkg9xAAAC 的连接在页面加载时中断

有没有办法解决这个问题,请给我建议...

【问题讨论】:

    标签: websocket socket.io ngrok


    【解决方案1】:

    请检查
    1) Chrome 和 Firefox 版本。旧版本可能不完全支持 WebSockets What browsers support HTML5 WebSocket API?
    2) 测试基本代码::先用普通的 JavaScript 代码试试看是否建立连接:-

    websocket = new WebSocket(URL);
    websocket.onopen = function(evt) {
        alert("Connected...");
        websocket.send(message);
    websocket.onmessage = function(evt) {
        alert(evt.data);
    };
    websocket.onclose = function(evt) {
        alert(evt.data);
    };
    websocket.onerror = function(evt) {
      alert(evt.data);
    };
    

    【讨论】:

    • 感谢您的帮助.. 它工作正常.. 在我只使用 chrome 和 mozila 浏览器之前。现在我将它检查到 Internet Explorer 现在它工作正常。非常感谢....
    猜你喜欢
    • 2015-09-24
    • 2020-11-17
    • 2021-01-30
    • 2015-01-08
    • 2019-04-10
    • 1970-01-01
    • 2017-09-17
    • 2012-03-04
    • 1970-01-01
    相关资源
    最近更新 更多