跨网页和 C++ 的数据交换后端组件

发布于 2024-10-07 05:30:52 字数 905 浏览 0 评论 0原文

我正在考虑为数据分析包设计一个基于网络的前端。这就是我的想法:

数据分析作业被提交到队列中。

人们可以登录前端并选择在本地计算机上运行作业或将新作业添加到队列中。

详细信息:

  1. 一个人登录到 Web 应用程序,可以选择运行本地计算机上工作队列中的现有作业,或者向工作队列分配一个新作业

  2. 如果选择在本地计算机上运行作业,则网页会查询安装在本地计算机上的软件包本地机器:“这是我给你的工作。你需要多长时间才能完成这个?”

    2.1 包将向网页返回一个值(基于启发式)

    2.2 网页可以根据返回值选择 将工作分配给当前 机器

    2.3 如果作业分配到当前机器,则后端包 一直继续前进 保持网页更新 它正在取得进展。

    一项工作可能需要几秒钟的时间 几个小时才能完成。

    2.4 任何时候网页都可以告诉包“你花费的时间太长 - 把你有的东西发给我”或者也许“我有一些对你来说更重要的东西 - 把你有的发给我”。

    包可以通过连接到 webapp 后端来发送它所拥有的数据

这需要在 Windows 和 Linux 上运行 - 所以我将使用 npapi 插件架构。

网页将通过 Javascript 完成大部分交互。

我的问题是

  1. 如何让 C++ npapi 插件向网页 javascript 返回一个值(json 结构),然后在网页中执行一个函数,而无需网页要求插件执行这样做(实现2.1)。也就是说 - 插件发起交互,而不是通常的“网页要求插件做某事”

  2. 是否有比 setInterval 更好的方法来实现 2.3?

I am thinking of designing a webbased frontend to a dataanalysis package. This is what I have in mind:

Data-analysis jobs are submitted to a queue.

People can login to the frontend and choose to run a job on the local machine or add a new job to the queue.

Details:

  1. A person logs into the web-application and can either choose to run an exisiting job in the work queue on the local machine or assign a new job to the work queue

  2. If a job is selected to be run on the local machine, the webpage queries the package installed on the local machine : "This is the job I have for you. How long would it take for you to finish this?"

    2.1 The package would return a value (based on heuristics) to the webpage

    2.2 The webpage can, depending on the value returned, choose to
    allocate the job to the current
    machine

    2.3 If the job is allocated to the current machine, the backend package
    goes on its way all the while
    keeping the webpage updated with the
    progress it is making.

    A job can take from a few seconds to
    a few hours to finish.

    2.4 Any time the webpage can tell the package "You are taking too long -
    send me what you have" or perhaps "I have something more important for you -
    send me what you have".

    The package can send the data it has by connecting to the webapp backend
    directly at this point.

This needs to run on Windows and Linux - so I will be using the npapi plugin architecture.

The webpage would do most of the interfacing via Javascript.

My questions are:

  1. How do I make the C++ npapi plugin return a value (a json structure) to the webpage javascript and then have a function in the webpage execute without the webpage asking the plugin to do it (to achieve 2.1). That is - the plugin initiates the interaction instead of the usual "webpage asks the plugin to do something"

  2. Is there a better way to implement 2.3 than setInterval?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑,眼淚并存 2024-10-14 05:30:52

如何让 C++ npapi 插件向网页 javascript 返回一个值(json 结构),然后让网页中的函数执行,而无需网页要求插件执行此操作(实现 2.1)。也就是说 - 插件发起交互,而不是通常的“网页要求插件做某事”

使用 这个例子

是否有比 setInterval 更好的方法来实现 2.3?

setInterval 效果很好。

How do I make the C++ npapi plugin return a value (a json structure) to the webpage javascript and then have a function in the webpage execute without the webpage asking the plugin to do it (to achieve 2.1). That is - the plugin initiates the interaction instead of the usual "webpage asks the plugin to do something"

Use this example.

Is there a better way to implement 2.3 than setInterval?

setInterval works well enough.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文