Use 'Chrome Native Messaging' from Sublime Text plugin

前端 未结 1 581
闹比i
闹比i 2020-12-17 05:35

With \'Native Messaging\' it should be possible to communicate between a chrome extension and a native app. https://developer.chrome.com/extensions/nativeMessaging

G

相关标签:
1条回答
  • 2020-12-17 06:22

    Native messaging cannot connect to an arbitrary process, because:

    1. The process must be talking over stdin using the specified protocol, or Chrome will break the connection off. I doubt Sublime plugins can alter Sublime's behavior in this case.
    2. Chrome will always run a new instance of the specified host; it cannot connect to an existing one.

    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.

    0 讨论(0)
提交回复
热议问题