user1549841
user1549841

Reputation: 51

open websocket connection firefox addon

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/.

Upvotes: 5

Views: 6374

Answers (1)

daf
daf

Reputation: 5240

Currently, it seems the only option is to proxy your WebSocket messages through a PageWorker. There is an example of how to do this on this website:

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

Upvotes: 1

Related Questions