native-messaging icon indicating copy to clipboard operation
native-messaging copied to clipboard

Issue handling the message from the browser

Open ElModdy opened this issue 6 years ago • 1 comments

Hi, sorry for my english. Sometimes the module can handle the request like so: normal other times it splits the message in two parts and can't pass your if statement like so: issue. PS. This happens in the same process with the same postMessage the only thing that change is the time :smile:.

ElModdy avatar Mar 27 '19 10:03 ElModdy

I had the same issue (with firefox), the issue is that sometimes (not sure if this is firefox specific or not) Firefox will send only the size of the payload, and in its next batch of stdout spamming will send the actual payload.

So if you try to read the size off stdout each time the readable event is emitted, you'll read a garbage size.

I created a simple library which addresses the issue, I know I should have submitted a PR here instead but this issue was more than a year old with no activity so I didn't :(

Someone can easily "steal" the code from there to patch this.

pyrho avatar Feb 18 '20 02:02 pyrho