Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

外部程序如何给指定窗口发消息 #106

Open
jsRuner opened this issue Apr 15, 2024 · 2 comments
Open

外部程序如何给指定窗口发消息 #106

jsRuner opened this issue Apr 15, 2024 · 2 comments

Comments

@jsRuner
Copy link

jsRuner commented Apr 15, 2024

目前有一个python程序,是后端处理任务。

窗体2前端有个按钮,点击触发发送http请求,触发任务。

但是任务需要试试给前端发送数据。

目前的方案是 python 先发送 到 websocket ,然后websocket 发送到前端窗体1,窗体1再发送到窗体2

这个方案目前跑成功了,但是链路太长了。 如何从websocket 直接发送到窗体2

@wallace5303
Copy link
Collaborator

主进程的websocket可以直接发送到窗体2

比如你创建了窗体2,获得它的对象实例 subWin;subWin.webContents.send(channel, '');

@jsRuner
Copy link
Author

jsRuner commented Apr 20, 2024

主进程的websocket可以直接发送到窗体2

比如你创建了窗体2,获得它的对象实例 subWin;subWin.webContents.send(channel, '');

对象实例这个,有统一存储的地方,只能自己存储吗? 例如创建和使用的时候不是一个地方。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants