javascript - How to use Websocket for Firefox Android Addon -


i trying write simple firefox mobile addon talks server side code using websocket.

i have code working desktop firefox addon having difficulty 1 firefox mobile.

function connecttoserver(awindow) {  var ws = new mozwebsocket("ws://ipaddress:8887");  // line 20 // var ws = new websocket("ws://ipaddress:8887"); ws.onopen = function() {     showtoastmsg(awindow, 'sending');     ws.send('data'); }    ws.onmessage = function (evt) {      showtoastmsg(awindow, 'display') };   ws.onclose = function() {  };   

i have tried both mozwebsocket , websocket, both of them gives me error similar following :

e/geckoconsole(15569): [javascript error: "referenceerror: mozwebsocket not defined" {file: "resource://gre/modules/xpiprovider.jsm -> jar:file:///data/data/org.mozilla.firefox/files/mozilla/sq4c77hi.default/extensions/view-source@mydomain.org.xpi!/bootstrap.js" line: 20}]

anyone know need import or able reference websocket? want send data , forth firefox android addon server side code using websocket. suggestions?

i confused because have setup running on firefox desktop addon similar code.

any appreciated thank you!

try next solution

var ws = new services.appshell.hiddendomwindow.websocket("ws://ipaddress:8887"); 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -