Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 734
user1549841 Avatar asked Nov 14 '22 01:11

user1549841


1 Answers

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/

like image 156
daf Avatar answered Dec 28 '22 11:12

daf