Use 'Chrome Native Messaging' from Sublime Text plugin

不问归期 提交于 2019-11-29 05:14:15

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!