vakho10/Native-Messaging

I can't read message from start.cmd

Closed this issue · 8 comments

use readMessage i got nothing.
check args i got --parent-widnow=xxxx,chrome-extentions://xxxxx

start.cmd like this

java -Xdebug -Xrunjdwp:transport=dt_socket,address=9998,server=y,suspend=n -jar "%~dp0/extentions-0.0.1-SNAPSHOT-jar-with-dependencies.jar" %*

the message send from page is "{"AuthKey":"niuniu","Pensize":2,"DrawType":0,"TrackColor":255,"EditBorderColor":16711680,"Transparent":240,"SetSaveName":"aaaa","SetMagnifierLogoText":"bbbb","SetWatermarkPictureType":3,"SetWatermarkPicturePath":"","SetWatermarkTextType":1,"MosaicType":1,"DefaultPath":"1.jpg","HideCurrentWindow":0,"AutoCaptureFlag":0,"x":0,"y":0,"Width":0,"Height":0}"

do you know what's the problem ?

in chrome_debug.log i found

[2132:2840:0518/105851:ERROR:native_message_process_host.cc(292)] Native Messaging host tried sending a message that is 1953720652 bytes long.

it's seem like chrome problem ? but i search from stackoverflow,there say it's java problem. sadness.

btw,my chrome version is 52,os is Windows 7

@magixsource The native messaging's "message" you receive itself can be 1MB maximum. This is the quote from their website: "The maximum size of a single message from the native messaging host is 1 MB, mainly to protect Chrome from misbehaving native applications" and here's the link: https://developer.chrome.com/extensions/nativeMessaging

@vakho10 Thanks, "message" i send in customevent just a json string not big than 1MB
but how pity chrome logging could not show me why 1953720652 bytes long.

@magixsource I have seen your JSON message and I do understand that it is way smaller than 1MB, but maybe your application continuously sends data or sends JSON first and then some huge data.1953720652 bytes is a lot of data. Don't forget that first 4 bytes you send is the size of message and then comes the message itself. Maybe that's the problem?

@vakho10 Hey,Today i try to build an exe host in C++, and i send same message like 2 days ago,in chrome logging console,i can't find native_message_process_host.cc error anymore.
i don't know why,but i will stop develop java host and change to develop c++ host.

do you know how to mock native message protocol message ? thanks.
:)

@magixsource Sadly, no.

@vakho10 Hey bro,I know why my java jar host "Native Messaging host tried sending a message that is 1953720652 bytes long". that's because java debug args " -Xdebug -Xrunjdwp:transport=dt_socket,address=9998,server=y,suspend=n",may be dt_socket try to write some data to stdout,so chrome native message received and error,haha.
i remove deubg args so java jar host work well . 👯

@magixsource I'm glad to hear that.