We have a web-app for android/ios with c++ code embedded as DLL, and we want the javascript to communicate to the c++'s DLL and there seems to be two main ways of doing it:
1) Write a cordova plugin to interact with java/obj-c and write adapters in java/obj-c to talk to DLL and relay the info back to javascript.
cordova.exec(function(winParam) {},
function(error) {},
"service",
"action",
["firstArgument", "secondArgument", 42, false]);
2) Spawn a local webserver in c++ and make the javascript AJAX directly to the c++, thus cutting out the middle-man.
//c++ local webserver with boost.asio
It is quite unclear how in (1) exec.js does the js to native bridge internally, does it use XHR itself or does it use some other faster method. Is using local webserver (2) to communicate with js using sockets relatively slower than using (1). If so, how much overhead does local webserver communication have compared to serial function calls?
Aucun commentaire:
Enregistrer un commentaire