本地消息传送,请参阅:关闭后重新建立与主机应用程序的连接 [英] Native messaging, re: re-establishing a connection with host application after close

查看:128
本文介绍了本地消息传送,请参阅:关闭后重新建立与主机应用程序的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个功能扩展与本地主机C#应用程序进行通信。在关闭并重新打开它后,寻找一种方式来自动重新建立与C#应用程序的连接。任何帮助不胜感激。本地消息传递意味着只有Chrome可以在连接时启动主机实例。 这是一个用词不当,因为 connect()表示启动一个新的副本并与之通话。

没有办法附加到已经运行的过程。如果关闭主机,stdio管道会破坏 Port 对象触发 onDisconnect 事件。然后,您需要从分机上重新启动主机才能与其通话。


I have a functioning extension that communicates with native host C# app. Looking for a way to automatically re-establish a connection with the C# app after I close and re-open it. Any help greatly appreciated.

解决方案

Native messaging means only Chrome can start a host instance when it "connects". It's a misnomer, since connect() means "launch a new copy and talk to it".

There is no way to "attach" to an already-running process. If you close the host, stdio pipe is broken the Port object fires onDisconnect event. Then you need to re-launch the host from the extension to be able to talk to it.

这篇关于本地消息传送,请参阅:关闭后重新建立与主机应用程序的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆