Native-Messaging | Chrome 's native messaging example project for Java | Browser Plugin library
kandi X-RAY | Native-Messaging Summary
kandi X-RAY | Native-Messaging Summary
Chrome's native messaging example project for Java.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Starts an incoming request
- Read a message
- Gets the bytes of the given length
- Send a message
- Get an int from a byte array
- Gets the detail message
- Sets the message
Native-Messaging Key Features
Native-Messaging Examples and Code Snippets
Community Discussions
Trending Discussions on Native-Messaging
QUESTION
I am trying to get Native Messaging between my chrome extension and my c# application. But below are my questions :
How to open only one Native app at a time ?. Clicking on the extension again will open the Native app again & again.
Can I communicate with an already open native app?
I built my extension and native app using the code in the following question.
...ANSWER
Answered 2022-Mar-25 at 12:47Native Messaging works by starting a new application process, then communicating with it over STDIO as long as Chrome keeps the connection open. If you don't keep the connection open, you can't "reconnect" to an application. To keep the connection open, you'll probably need to open it from the event script.
See this question: How to get Chrome Native Messaging to Listen to application? It discusses some of this topic, including C#-specific ways to keep it a single instance.
Furthermore, consider using alternative solutions, such as web communication (for example, WebSockets) to a local port exposed by your native code, though it creates new security questions (how to make sure it's your extension talking to it?).
QUESTION
I've got sequences working in my Knative environment. We're trying to configure and confirm the DLQ/Dead Letter Sink works so we can write tests and things against sequences. I can't for the life of my get Knative to send anything to the Dead Letter Sink. I've approached this two ways, the first was setting up a Broker, Trigger, Services and a Sequence. I've defined in the Broker a service to use for the DLQ. I then setup a service in the sequence to intentionally returned a non-200 status. When I view the logs for the channel dispatcher in the knative-eventing namespace, I believe what I read is that it thinks there was a failure.
I read some things about the default MT Broker maybe not handling DLQ correctly so then I installed Kafka. Got that all working and essentially, it appears to do the same thing.
I started to wonder, ok, maybe within a sequence you can't do DLQ. After all the documentation only talks about DLQ with subscriptions and brokers, and maybe Knative believes that the message was successfully delivered from the broker to the sequence, even if it dies within the sequence. So I manually setup and channel and a subscription and sent the data straight to the channel and again, what I got was essentially the same thing, which is:
The sequence will stop on whatever step doesn't return a 2XX status code, but nothing gets sent to the DLQ. I even made the subscription go straight to the service (instead of a sequence) and that service returned a 500 and still nothing to the DLQ.
The log item below is from the channel dispatcher pod running in the knative-eventing namespace. It basically looks the same with In memory channel or Kafka, i.e. expected 2xx got 500.
...ANSWER
Answered 2021-Nov-30 at 18:05there was some issue with Dead Letter Sinks not being propagated at pre-GA releases. Can you make sure you are using Knative 1.0?
This is working for me as expected using the inmemory channel:
https://gist.github.com/odacremolbap/f6ce029caf4fa6fbb3cc1e829f188788
- curl producing cloud events to a broker
- broker with DLS configured to an event-display
- event display service as DLS receiver
- trigger from broker to a replier service
- replier service (can ack and nack depending on the incoming event)
QUESTION
I am trying to call a MacOS app written in Objective C from a Browser extension using native messaging.
So far I have come up with this code which handles requests made with chrome.runtime.sendNativeMessage.
...ANSWER
Answered 2021-Nov-20 at 03:00The solution is:
QUESTION
I had the intention of attempting to build (move) a desktop application in Tcl/Tk after reading about it first on the SQLite web site. I read over some older books on the openlibrary.org and purchased a new printing of one of them. It appears to be a decent text but every reference to a web site for some utility to build a starpack appears to be outdated.
I can't find a tclkit. One site that states you can build one online fails. I came across Freewrap which is as recent as Sep. 2020 but is still behind the most recent version of Tcl/Tk. I don't understand what ActiveTcl is from its site.
Is this something that one can compile from sources or is it available only from one of these utilities?
I'm not trying to criticize it but would like to make sure I'll be able to build an executable at the end of the project and that I start within the correct set up.
Perhaps I've misunderstood something. I've been using C compiled with the SQLite amalgamation and the native-messaging API of a web extension to use a browser as the UI. It works pretty well; however, after reading about Tcl/Tk, it appears that all the same can be done more efficiently and without the browser and still connect to a server when needed through Tcl. I prefer that a lot.
Ultimately, I want to build something similar to a highly searchable library with pre-built tables, similar to the structure of a Biblical concordance, such that searches across texts can be performed quickly and compared, and linked to other resources. When I have new resources available, I'd like to be able to easily add the necessary components for the user from a server such that those resources become part of the searchable content.
I realize that is sort of vague but is this a good use case for Tcl/Tk, can it be made into a starpack, and, if so, where can the current utility or method of making one be found?
Thank you.
Came across this article which was helpful. There is also a book as recent as 2017.
...ANSWER
Answered 2021-Mar-21 at 18:03A starkit is an archive format (based on the Metakit single-file database format) that has been used to distribute Tcl applications and extensions; these can be either platform-specific or cross-platform, depending on what you put inside. Tclkit (or its more modern versions from Kitgen) is a single-file Tcl distribution that can read and execute a starkit; it's naturally platform-specific. A starpack is a combination of tclkit base runtime and starkit-packaged application.
As the whole starkit/tclkit system is based on Tcl's virtualised filesystem support, you can put pretty much anything you want inside a *kit, including extension DLLs. About the only thing that it's not a great idea to put in is a database (such as an SQLite DB file); while you can put a copy inside, you'll need to extract it for use. I mention this because it sounds like including a database would be highly appropriate for your application.
For update, the simplest method is to just have users download a new copy of the application. Since you can make that into one pre-packaged file, this is very easy for them to handle updates for. (You can do automatic updating, but then you have to keep track of the file holding the updates; not all platforms allow updating a running executable.)
Tcl 8.7 will include a packaging technology for doing similar things, though based on a different file format. That's all still alpha though.
QUESTION
I'm writing a plugin in thunderbird using native messaging (following the ping pong example in python) to call a Delphi program to copy an e-mail locally as an ".eml" file. The problem I am facing seems to be the encoding. In addition, the resulting file contains double quotes ("") at the start and the end of the file as well as escaped double quotes (\"). I just want to have a 1 to 1 copy and not to change its content.
Example of a mail content:
...ANSWER
Answered 2020-Oct-28 at 16:11At first let me say that you did a good job in transferring data between web extension (Thunderbird add-on) and native application using native messaging. It isn't easy to understand it and set it up, but you managed to transfer required data with some tiny glitches you describe in your question.
... the resulting file contains double quotes (
"
) at the start and the end of the file as well as escaped double quotes (\"
)
In the add-on you obtain raw email data as a string - console.log(typeof raw)
gives string
which you then pass to port.postMessage
. Although the documentation says it takes JSON object representing the message to send, but it seems to accept single string value which is valid JSON according to some standards. In Delphi code you receive the message via STDIN
and parse it using TJSONObject.ParseJSONValue
into TJSONValue
. It will in fact create instance of TJSONString
. You can verify that by examining the value of jsonValue.ClassName
. The problem with quotes arises when you use jsonValue.ToString
which returns quoted version of the string that is basically the same what you had before parsing. Use the Value
property to return raw string value.
Using jsonValue.Value
alone will not help you with the encoding issue. The raw message data that you obtain from the e-mail client is in EML format. It conforms to RFC-822 and that means it is ASCII encoded, but it can contain arbitrarily encoded message parts (see your own sample EML). Since you only want to save EML file as is not taking any encoding into account, the best would be to transfer raw bytes of EML, but this isn't out-of-the-box supported by Javascript and native messaging API. Therefore I'd suggest you to send Base64-encoded data string to native application where you decode it into raw bytes that you can write straight to disk.
To encode raw message data as Base64 string in add-on use function btoa:
QUESTION
I tried to recreate the example to connect to my Xamarin Mac application using a chrome extension I will use as backbone for all other browsers, but it didn't work with the following error:
Error when communicating with the native messaging host.
The documentation seems straightforward on paper, but isn't that simple in the real life.
Here are my Read and listen functions (great examples there,https://github.com/anewtonlevey/NativeMessaging):
...ANSWER
Answered 2020-Feb-27 at 08:50Basically, the first 32 bits sent from the extension corresponds to the message length, in native order.
Since the first 32 bits are of type int, and I tried to parse JSON objects, Error when communicating with the native messaging host is raised. The documentation mentions that the issue resides within a broken Native Messaging protocol.
The worst part is that I saw it on the Python example, but thought that this was implemented by the programmer who did it.
I stumbled upon this thread on Stack Overflow which helped confirm, (Chrome App fails to communicate with native host on windows).
To debug Chrome in a much more verbose fashion, launch Chrome with --enable-logging=stderr --v=1 in the command line, and all stderr will be outputted there.
The documentation is mentioning it, but the examples found here and there using C# don't include them.
If I have time, I will confirm that this was the issue by editing this answer, and provide code for getting this to work on Visual Studio for macOS.
EditI managed to have this to work a few days ago. I modified the code so that it works without the while loop, as the StreamReader reads stdin until the end, thus not requesting a while loop (this caused my previous code to hang). The SendMessage method also differs from other seen in other examples. Fewer lines, and works just fine.
My working example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Native-Messaging
You can use Native-Messaging like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the Native-Messaging component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page