With 'Native Messaging' it should be possible to communicate between a chrome extension and a native app. https://developer.chrome.com/extensions/nativeMessaging
Google even provides an example for how to do this with a python "host"-app: https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host
I wanted to use this technique to communicate between a Sublime Text plugin (python) and an Chrome extension.
name
and the path
of the manifest file? The name and path of the sublime text application?stdin
and stdout
to communicate with chrome from the sublime text plugin or are there restrictions to this when you write a plugin?Sorry if this seems like a silly question, I usually do web, not native development.
Native messaging cannot connect to an arbitrary process, because:
stdin
using the specified protocol, or Chrome will break the connection off. I doubt Sublime plugins can alter Sublime's behavior in this case.So your hypothetical Native host must be a separate process, that can be restarted independently of Sublime and somehow talk to Sublime.
You don't actually need the Native Messaging protocol here. An alternative route is to use WebSockets: a Sublime plugin can act as a WebSocket server on localhost, and an extension can connect to that. See GhostText as an example of such architecture.