开发者

Data interchange across webpage and C++ backend components

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 o开发者_如何转开发n 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜