Firefox 扩展端口监听器
嘿,我正在尝试获取一个扩展来等待通过内部端口来自另一个程序的 xml 消息。只是等待一个 UTF-8 字符串,其中包含以下内容:
<?xml version="1.0"?>
<status received="true" state="started"></status>
我
<?xml version="1.0"?>
<status received="true" conn="closed"></status>
想可靠地报告两者之间的通信,以及一些不错的小错误消息。
我向其发送 xml 消息的程序是一个完全独立的 Java 应用程序,在用户的计算机上运行,该扩展允许用户通过浏览器使用该应用程序打开文件。当应用程序接收传入连接并发送 xml 状态更新时,它会在其使用的端口(以及扩展正在使用的端口)上发送多条 xml 消息。
Hey, I'm trying to get an extension to wait for a xml message from another program over an internal port. Just something like waiting for a single UTF-8 string that has something like:
<?xml version="1.0"?>
<status received="true" state="started"></status>
and
<?xml version="1.0"?>
<status received="true" conn="closed"></status>
I want to reliably report communication between the two, along with some nice little error messages.
The program that I'm sending xml messages to is a completely standalone Java application that runs on the user's machine, the extension is allowing the user to open files using that application through the browser. The application sends several xml messages out on the port its using(and thus the port the extension is using) when it receives incoming connections and sends out xml status updates.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我刚刚找到 nsIServerSocket 我认为这就是我想要的。我将尝试一下并报告回来,但如果有人知道更合适的 Mozilla 服务,请告诉我们!
I just found nsIServerSocket and I think this is what I want. I'm going to try it out and report back, but if anyone knows of a more appropriate Mozilla service to use please tell!
为什么不使用 websockets 或 ajax 调用,特别是如果它是您尝试连接/侦听的内部端口后面的网络服务器?
Why not make use of websockets or ajax calls, particularly if it a webserver behind the internal port you are trying to connect / listen ?
如果您只需要从用户计算机读取/写入文件,为什么不简单地使用 Mozilla 提供的 API 而不是使用 java 程序来做同样的事情?
If you just need to read/write files from the user computer, why don't you simply use the APIs provided by Mozilla instead of using a java program to do the exact same thing?