Hi ,Thank you for the solution. It is working fine now.I am trying to run the native messaging app from "Chromium" OS ,I am getting Native messaging host not found error.Do I need to manually create /etc/opt and copy the Manifest file for host?I have also tried on On chromebook pixel booted in developer mode but it is not allowing me to create the /etc/optHow to manually deploy and test native host messaging app on a chrome book and Chromium in developer mode?Thanks and Regards,-VidyaOn Mon, Mar 10, 2014 at 3:31 AM, Rajesh Katalkar <rajesh...@gmail.com> wrote:
typo in code for writing
for writing back response string
cnt = length of response string
cout.write(reinterpret_cast<char*>(&cnt),4);cout<<response<<flush;On Mon, Mar 10, 2014 at 3:59 PM, Rajesh Katalkar <rajesh...@gmail.com> wrote:
Vidya,Mihai is right.Check my thread ..I think I already suggested this to you.The correct way is to use reinterpret_case<> ...
read code in my last comment.
https://groups.google.com/a/chromium.org/forum/#!mydiscussions/chromium-apps/i8K1vIJXB2w
int uint32_t = 0;
cin.read(reinterpret_cast<char*>(&cnt) ,4);for writing back response string
cnt = length of response string
cout.write(reinterpret_cast<char*>(&cnt),4);
cout<<data<<flush;On Mon, Mar 10, 2014 at 3:39 PM, Mihai Coman <mi...@quickweb.ro> wrote:
That code is wrong:for (i = 0; i <= 3; i++){// t += getchar();t += std::cin.get();}Even in decimal, if I send 1024 as 4 chars (1,0,2,4), all that code does is add them together and instead of getting a length of 1024, you'll get a "slightly" different value of X = 1+0+2+4.Try this instead (should work, unless you're targeting some IBM mainframes and such; ARM can be fun too - I didn't test it):uint32_t len = 0;std::cin.read((char*)&len,sizeof(len));
On Saturday, March 8, 2014 1:19:36 AM UTC+2, Vidya Pawar wrote:Hi,Here is the code which I am using as a Native-host in C++ got from the link belowwhile testing I got the issue that the code below is not sending more than 250 bytes ?Anybody know what might be causing the issueint main(int argc, char* argv[]){std::cout.setf( std::ios_base::unitbuf ); //instead of "<< eof" and "flushall"unsigned int a, c, i, t=0;std::string inp;bool bCommunicationEnds = false;do {inp="";t=0;// Sum the first 4 chars from stdin (the length of the message passed).for (i = 0; i <= 3; i++){// t += getchar();t += std::cin.get();}// Loop getchar to pull in the message until we reach the total// length provided.for (i=0; i < t; i++){//c = getchar();c = std::cin.get();//if(c == EOF)if(c == 65){bCommunicationEnds = true;i = t;}else{inp += c;}}if(!bCommunicationEnds){//Collect the length of the messageunsigned int len = inp.length();//unsigned int len = strJson.length();//// We need to send the 4 btyes of length informationstd::cout << char(((len>>0) & 0xFF))<< char(((len>>8) & 0xFF))<< char(((len>>16) & 0xFF))<< char(((len>>24) & 0xFF));//// Now we can output our messagestd::cout << inp;}}while(!bCommunicationEnds);return 0;}Thanks and Regards,-Vidya
On Friday, February 21, 2014 9:44:03 AM UTC-8, Rajesh Katalkar wrote:Vidya, take look at this discussion which I had when I developed native host for windows. .you can use the same. ..it just has basic code of reading and writing. ...I did not completely update the code in post. ...but you can use the same style to write as was used to read....i. e use cout.write etc....also you have to use some jsonlibrary to parse etc.
Sent from LG
On Feb 21, 2014 2:40 AM, "Vidya Pawar" <vidyap...@gmail.com> wrote:Now does anyone has any working example of Native host written in C++?On Thu, Feb 20, 2014 at 7:59 AM, Rajesh Katalkar <rajesh...@gmail.com> wrote:
That's great Vidya ,that you solved the problem . No idea how others did not face this problem. You should report this to the author. ...
Sent from LG
On Feb 20, 2014 3:35 AM, "Vidya Pawar" <vidyap...@gmail.com> wrote:Finally I am able to make it run without any issueswhen I replace the ' Path' value from .json filefrom/home/vidya/Bay/BYT-Chrome-App/host/NativeMsg-Example/host/native-messaging-example-host
to/home/vidya/Bay/BYT-Chrome-App/host/NativeMsg-Example/host/native-messaging-example-host.py
It started running. :)so there is a bug in install_host.shon Linux the Path value should be "native-messaging-example-host.py"
Cheers!-VidyaOn Wed, Feb 19, 2014 at 11:54 AM, Vidya Pawar <vidyap...@gmail.com> wrote:
I put the breakpoints in python file and debug the python file with pdb.from the packaged app when I click on connect , the control does not even come to the breakpoint set in the python file.It means it is not even starting / making the connection with the native application.reply if anyone face these problems ?--
On Wed, Feb 19, 2014 at 10:48 AM, Vidya Pawar <vidyap...@gmail.com> wrote:when I click on connect it display following messageFailed to connect : Naive host has exitedany idea?--On Wed, Feb 19, 2014 at 10:19 AM, Vidya Pawar <vidyap...@gmail.com> wrote:Yes, I tried it and I am able to run the alone python native app.from the command line I give the following command and a Window having name as 'Native-Messaging-Example' comes properly.python ./native-messaging-example-host.pythe problem is in making the connection.As per the documentation my understanding was, the app will look for .json in /etc/opt/chrome/native-messaging-hosts from where it will get the PATH for the native application in this case is as below/home/vidya/Bay/BYT-Chrome-App/host/NativeMsg-Example/host/native-messaging-example-host
then the communication will happen,No issues with just running the .py file.How can I do the message passing?--
On Wed, Feb 19, 2014 at 10:06 AM, Rajesh Katalkar <rajesh...@gmail.com> wrote:Can you run the same file without extension. ...how do you run that file? Paste the command here. ..
If you see the Windows version. ...bat file...here it runs the file with python comand. ...but that's Windows requirement...
You can try same thing. ..i. e write a shell script file which will run the Python file.and then use this file in path in json.If this does not help then chrome devs or the author of that example can help you.
Sent from LG
On Feb 19, 2014 11:11 PM, "Vidya Pawar" <vidyap...@gmail.com> wrote:No, I have used the install.sh .and the .json got copied to appropriate path which is /etc/opt/chrome/native-messaging-hoststhe "path" is also pointing to the correct value"path": /home/vidya/Bay/BYT-Chrome-App/host/NativeMsg-Example/host/native-messaging-example-hostin the above value it should be native-messaging-example-host.py OR native-messaging-example-hostthe folder structure is same as given in thelike-app- icon-128.png-main.html-main.js-manifest.json-host-com.google.chrome.example.json-install_host.sh-native-messaging-example-host.py-uninstall_host.shdoes this look appropriate?Thanks and Regards,-VidyaOn Tue, Feb 18, 2014 at 8:13 PM, Rajesh Katalkar <rajesh...@gmail.com> wrote:
By error it looks like it has not found the native host.I don't know about linux environment as I use windows. ...
Did you place the json file in proper place. ...are you doing this manually?
If you have not already done it, I will suggest using install.sh script provided with the example to install the host properlySent from LG
On Feb 19, 2014 6:52 AM, "Vidya Pawar" <vidyap...@gmail.com> wrote:When I step into the port.postMessage() function it gives me errorUncaught Error: Attempting to use a disconnected port object"When I run the native-messaging-host-example.py , it pop-ups the window it mean there is no issue with the Native application.While communicating I am getting the above error.You have any idea?Thanks and Regards,-Vidya
On Tue, Feb 18, 2014 at 12:54 PM, Vidya Pawar <vidyap...@gmail.com> wrote:Hi Rajesh,yes I have installed Python 2.7.6 on Windows and my Linux system has Python 2.7.3The documentation did not mention any other dependencies.
Thanks and Regards,-Vidya--On Tue, Feb 18, 2014 at 11:13 AM, Rajesh Katalkar <rajesh...@gmail.com> wrote:
The example needs python. ..have you installed it....check what are it's dependency and install it.....
I have used a very old example but it may be changed and improved now.
Sent from LG
On Feb 19, 2014 12:32 AM, "Vidya Pawar" <vidyap...@gmail.com> wrote:To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/CAKfOme0-r0SA8q4Yh%2Bkn4dr%3DYXWWS%3DTf8FNASonWZj1Uy53Eog%40mail.gmail.com.Hi Aki,Thank you!.That error has been gone. Now when I am trying to send a message to Native app it gives to following errorFailed To connect : error when communicating with the native messaging host"The Port Objects OnDisconnect() get called during the SendMessage() call.In my case as I am using Native Messaging API, I am usingvar host = "com.google.chrome.example.echo";var port = chrome.runtime.connectNative(host);As I said earlier I am trying to do the similar stuff like accessing the hardware diagnostics information,which uses system files and calls, so using Native Messaging APIsI am getting same error on Linux and Windows.
Do you have any working example of this.Thank you!Thanks and Regards,-Vidya--On Mon, Feb 17, 2014 at 1:38 AM, Aki Kanerva <aki....@gmail.com> wrote:
Hi Vidya,That looks more like a regular javascript error that doesn't have anything to do with native messaging. You would get that error if your code contains text that isn't properly enclosed in quotes and also has a slash in it. In javascript, enclosing a string in slashes instead of quotes makes it a regular expression, which is used for some things like string.match() and string.replace().For example:var s = /foo/bar;should be:var s = "/foo/bar";
This is just a wild guess, but are you perhaps trying to launch your native host using the executable path instead of the name? The argument you need to pass to chrome.runtime.connectNative() is the name defined in the manifest, not the actual executable path. For example, if your host manifest looks like this:
{"name": "com.mynamespace.myhost","description": "Example native messaging host","path": "host.sh","type": "stdio","allowed_origins": ["chrome-extension://my-extension-id/"]}Then you would launch it in your extension code like this:var host = "com.mynamespace.myhost";var port = chrome.runtime.connect(host);-- Aki
On Thursday, February 13, 2014 1:10:27 AM UTC+2, Vidya Pawar wrote:Hi Aki,After reading through this thread, looks like you might have the answer to my issueI am trying to do the similar stuff like accessing the hardware diagnostics information,which uses system files and calls, so NACL is not an option.I am trying to do it on Linux. Basically I do have the Linux utility which displays hardware diagnostics information, so I want to utilize that command line (I believe that could be my native host ,please correct me I am wrong)
I just gone through the following linkand trying to run the sample native messaging application given in link below on LinuxI see the app under app section.It loads the main.html but after loading the app I am getting following JavaScript error in the 'Console' section
Uncaught SyntaxError: Invald regular expression: missing /the com.google.chrome.example.echo.json is copied to appropriate location under my Linux system as below/etc.opt/chrome/native-messaging-hostsAfter searching about this , I got couple of solutions but still not able to fix this issue.You have any idea what me causing the issue?If you have any working example of NativeMessaing host,that would really help me to expatiate my experiment.Kindly reply.Thank you in advance!Thanks and Regards,-Vidya
On Friday, January 24, 2014 3:35:18 AM UTC-8, Aki Kanerva wrote:Hi Guerry,That looks like exactly what we need as well.We're trying to utilize new input hardware. NaCl is not an option because its whole point is to prevent OS-level calls, so it's not possible to link hardware driver libraries into a NaCl executable. Native messaging appears to be the only method available at the moment. Since the hardware is only supported on Windows anyway, being OS agnostic isn't an issue.
Looks like a similar discussion is going on in another place, too:That thread also mentions that bundling the native messaging host would be a good idea, because it would allow the Chrome Web Store to scan for malware. It makes sense - a separate installer for the native messaging host would be outside of Web Store control.Hope bundling does make it in.-- Aki
On Thursday, January 23, 2014 6:58:45 PM UTC+2, Guerry Semones wrote:Hi Aki,What you are proposing has been posted as a bug/feature/whatever request at the link below. There is some discussion there, and last I saw, this was being considered. Our team would also like to see a solution like this.Thanks,G
On Thursday, January 23, 2014 7:14:41 AM UTC-6, Aki Kanerva wrote:Hi guys,I'm developing an extension that uses a native messaging host. I have everything running smoothly, but have a problem regarding installation. I can't find a way to use a relative path to the manifest file in the Windows registry key.Based on what I've seen, the preference is to bundle the native host executable with the extension itself, then use an installer to register the path to the manifest. Therefore, it should be simple enough to set the key value to refer to a file inside the extension package:host\host_manifest.jsonBut this produces an error message saying "Specified native messaging host not found".It works if I use the absolute path:C:\Users\<USERNAME>\AppData\Local\Google\Chrome\User Data\Default\Extensions\<EXTENSION>\<VERSION>\host\host_manifest.json
However, there are many variables in that path: account name and Chrome profile folder, not to mention the browser name (Chrome, Chromium or something else entirely). Is it even possible to make an installer that can guess all of these correctly and create the registry key?
Another option would be to install the manifest and executable into a known folder, say under Program Files. However, this means that the host executable can't be updated just by updating the extension. In addition to updating the extension, users would also have to run the separate installer every time to overwrite the old executable with the new one. This doesn't seem very handy either.Is there something I've missed?Thanks in advance,Aki KanervaTo view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/51ad1612-158c-44f6-90ae-181185183d18%40chromium.org.--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.---Vidya
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.-Vidya---Vidya---Vidya-Vidya-Vidya-Vidya---Vidya---VidyaTo view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/5b45df10-1ac2-4dad-8cd7-afe6b1fe077a%40chromium.org.--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.---Vidya