使用Firefox的WebWorkers和WebSockets [英] WebWorkers and WebSockets with Firefox

查看:142
本文介绍了使用Firefox的WebWorkers和WebSockets的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在WebWorker中实现一个可用的WebSocket连接。这应该是简单的,这是如果我使用Chrome作为B rowser。然而,因为这个实验应该进一步成为一个生产的一部分,我需要它在所有的伟大的浏览器,也就是Firefox。



我的问题是,我不能让它与Firefox的工作。起初Firefox不能创建WebWorker。这是一个错误,并与版本9固定。但现在看来,它不能够在工人中创建一个WebSocket。



我试过下面的行代码:

  var ws = new WebSocket(url); 

失败:

  WebSocket没有定义

那么,根据它应该工作。但是,它不在WebWorker内部,也不在这个范围之外。我尝试了更旧的

  var ws = new MozWebSocket(url); 

这似乎在WebWorker之外工作,但是我得到了与上面相同的错误。 p>

现在,有什么问题?我知道WebSockets在某些旧版本中禁用了byy默认,但是版本9应该支持与Chrome类似的功能(至少他们这样说)。所以我做错了什么?



我使用Ubuntu 11.10,并没有测试其他浏览器。



提前解决!

解决方案

现在Firefox中的工作者还不支持WebSocket。请参阅 https://bugzilla.mozilla.org/show_bug.cgi?id=504553


更新:Firefox 35增加了支持。


I'm trying to implement a working WebSocket connection within a WebWorker. That should be simple and it is if I use Chrome as b rowser. However, since this experiment should further become part of a production I need it to work on all the great Browsers, namely also Firefox.

My problem is that I can't get it working with Firefox. At first Firefox wasn't able to create a WebWorker. That was a Bug and is fixed with version 9. But now it seems that it wouldn't be able to create a WebSocket within the Worker.

I tried the following line of code:

var ws = new WebSocket(url);

which fails with:

WebSocket is not defined

Well, according to this it should work. But it doesn't, neither within the WebWorker nor outside of this context. I tried the older

var ws = new MozWebSocket(url);

which seems to work outside of the WebWorker but I get the same error as above within it.

Now, what's the problem? I know WebSockets where disabled byy default in some older versions but version 9 should support a similar functionality as Chrome (at least that's what they say on their side). So am I doing something wrong?

Im using Ubuntu 11.10 and did not test other browsers yet.

Thanks in advance!

解决方案

There's no support for WebSocket in workers in Firefox yet. See https://bugzilla.mozilla.org/show_bug.cgi?id=504553

Update: Firefox 35 added support.

这篇关于使用Firefox的WebWorkers和WebSockets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆