5

Is it possible for a firefox addon to establish a websocket connections?

When I try:

var wsUri = "ws://echo.websocket.org/";
var ws = gBrowser.contentWindow.window.WebSocket ||
         gBrowser.contentWindow.window.MozWebSocket;    
var websocket = new ws(wsUri);

In the Error Console the message says

Error: Firefox can't establish a connection to the server at ws://echo.websocket.org/.

4

1 回答 1

1

目前,似乎唯一的选择是通过PageWorker. 在这个网站上有一个如何做到这一点的例子:

http://austinhartzheim.me/blog/4/websockets-firefox-sdk-addons/

于 2014-10-02T00:43:31.450 回答