Google Chrome Extension Using With UDP -


i want develope basic extension. extension should communicate on udp. extension messaging. want create client. because create server in java. client can sent message server , server can message client.

i @ chrome developer page. these documents not date. create basic client this:

// values var address     = null; var connect     = null; var disconnect  = null;  // udp-object var echoclient  = null;  // -------------------------------------------------------------------------------------------------------------------  window.addeventlistener("load", function() {    // input: address.val   address = document.getelementbyid("address");    // button: connect.val   connect = document.getelementbyid("connect");    // button: disconnect.val   disconnect = document.getelementbyid("disconnect");    // button: connect.func   connect.onclick = function(ev) {     if(address.value != ""){       echoclient = newechoclient(address.value);     }   };    // button: disconnect.func   disconnect.onclick = function(ev) {     echoclient.disconnect();   }    // send data   setinterval(function(){      echoclient.sender();   }, 1000);  });  // -------------------------------------------------------------------------------------------------------------------  var newechoclient = function(address) {   var ec            = new chromenetworking.clients.echoclient();   ec.sender         = attachsend(ec);   var hostnameport  = address.split(":");   var hostname      = hostnameport[0];   var port          = (hostnameport[1] || 7) | 0;   ec.connect(     hostname, port,     function() {       console.log("connected");     }   );   return ec; };  var attachsend = function(client) {   var = 1;   return function(e) {     var data = i;     i++;     client.echo(data, function() {         console.debug(data.data); // problem here     });   }; }; 

but code not working. in chrome took error:

error in event handler sockets.udp.onreceive: rangeerror: byte length of uint32array should multiple of 4     @ chrome-extension://boeaihphlidceiemkegklmbmefjgogfk/networking.js:84:25     @ chrome-extension://boeaihphlidceiemkegklmbmefjgogfk/networking.js:31:34 

where wrong? problem?

afaik, chrome extension cannot use upd communication. stated in post, can either use both app , extension communicate, or use extension , native host.

i think chrome apps have access socket api , not chrome extension stated in post.

you can check this:

the references talks chrome extension can't use chrome.socket.

hope helps.


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -