使用Firefox的WebWorkers和WebSockets [英] WebWorkers and WebSockets with 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屋!