Multiple instances of Native Messaging Host

114 views
Skip to first unread message

Debjit Das

unread,
Dec 4, 2017, 1:57:24 AM12/4/17
to Chromium-dev
Hi

I am using Chrome extension (background script) to launch a Native Messaging Host. However when I refresh the page in which the extension is used, I see two instances of the host process created. How can I prevent multiple instances of the host process getting created either when a page is refreshed or when the same page is opened in another tab of the browser. Basically want a singleton instance of the host created.

Thanks,
Debjit

Asesh Shrestha

unread,
Dec 4, 2017, 11:40:33 PM12/4/17
to Chromium-dev
There's probably something wrong in your code. We will never know what's wrong in it. Refreshing a page or opening a new window of Chrome/Chromium won't launch another instance of your native messaging host.

Lambros Lambrou

unread,
Dec 5, 2017, 5:16:56 PM12/5/17
to Chromium-dev
I would expect that separate tabs/windows would need to talk to separate Native Messaging processes. The communication between the page and the NM host is via stdin/stdout pipes, so I don't see any other way this could possibly be implemented - how would a singleton host process know which tab/window a message originated from if everything goes through stdin/stdout?

Also, it goes against the principle of site-isolation if a single NM host process could communicate with multiple tabs.

If you need a singleton process, I guess you would need to implement a client-server system, with multiple NM host processes talking to a single server process (using your own choice of IPC).


”This email and any files transmitted with it may be confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender.”

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/e5ecfebf-7770-4570-a139-8df10afe6d5b%40chromium.org.

Reply all
Reply to author
Forward
0 new messages