问题描述
我创建了一个简单的 WebSocket 服务器,并尝试使用以下代码连接到它:
I've created a simple WebSocket server and am trying to connect to it with the following code:
function test(name) {
var ws = new WebSocket('ws://localhost:1234');
ws.onopen = function () {
ws.send('Hello from ' + name);
}
}
test('Edge');
这在 Windows10 上的 Chrome 和 IE11 上运行良好,但是当我从 Edge 尝试时,没有调用 onopen
函数,而是最终出现以下错误:
This works fine from Chrome and IE11 on Windows10 but when I try from Edge, the onopen
function isn't called, instead I eventually get the following error:
SCRIPT12029:WebSocket 错误:网络错误 12029,无法与服务器建立连接
Edge 的 12.10240 版本正在发生这种情况.
This is happening for version 12.10240 of Edge.
在 here 中询问了类似的问题,但是错误消息是不同的.
A similar problem was asked about here but the error message is different.
我尝试过的事情:
正如下面 tresf 指出的那样,about:flags 中的环回复选框似乎已停止工作(作为修复),因此您必须使用 CheckNetIsolation 命令,使 Edge 免除.
As tresf pointed out below, the loopback checkbox in the about:flags appears to have stopped working (as a fix), so you'll have use the CheckNetIsolation command, to make Edge exempt.
这篇关于WebSocket to localhost 在 Microsoft Edge 上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!