【问题标题】:How to solve the `meteor Js` websoket interrupted while the page was loading?如何解决页面加载时`meteor Js` websocket中断?
【发布时间】:2014-03-17 05:00:41
【问题描述】:

我是meteorJs 的新手,如何在网页加载时解决以下警告。当我运行流星 js 应用程序时,浏览器控制台出现以下警告。如何解决此警告请建议我。

Warning:
The connection to wss://ddp--5346-hcaresample.meteor.com/sockjs/611/6mo4f_7i/websocket was interrupted while the page was loading. @ http://hcaresample.meteor.com/b41c48c8636277a85e3a081bf7c1c8e4c50816d2.js:4

【问题讨论】:

  • 您使用的是什么浏览器/版本?我去页面时没有收到警告。
  • 我在最近的版本中也看到了这个错误,该错误显示在 Firefox 33,Meteor 版本 0.9.4
  • 我也在我的 live prod/dev/test 域上看到了这个 - 例如crowdcourier.cc 将显示我还在前面运行一个 nginx 反向代理,它将端口 3000 映射到 443 添加 ssl .当我访问localhost:3000 时,错误消失了。它实际上似乎有点间歇,在刚刚的测试中我开始怀疑是否涉及服务工作,因为它只是在单击刷新后才出现,而不是在初始页面加载等时出现。

标签: meteor


【解决方案1】:

也许尝试设置您的政策? 像这样:

import { BrowserPolicy } from 'meteor/browser-policy-common';

    let origin = "ddp--5346-hcaresample.meteor.com";
    BrowserPolicy.content.allowConnectOrigin("wss://" + origin);

    origin = "https://" + origin;
    console.log(origin);
    BrowserPolicy.content.allowOriginForAll(origin);
    BrowserPolicy.content.allowEval(origin);
    BrowserPolicy.content.allowInlineScripts(origin);
    BrowserPolicy.content.allowScriptOrigin(origin);
    BrowserPolicy.content.allowImageOrigin(origin);
    BrowserPolicy.content.allowConnectOrigin(origin);

【讨论】:

    猜你喜欢
    • 2020-11-09
    • 2018-02-27
    • 2012-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-12
    相关资源
    最近更新 更多