Re: C->JNI->fast webpage updates?



Joe wrote:

I'm serious about the static web page thing. Write a C program to put data in HTML, write it to disk. Users can fetch it there.

Oh, c'mon ... think web page inside an existing web app ...


You really haven't said why you need any kind of dynamic connection. Does the data arrive very fast? Is it different for each user? (You just said "no" to that one, actually.) How long will old data be stored?

Because the data is being fed across from the network. Yes, it arrives fast and can update very fast. Millisecond updates if need be.
Like I said elsewhere, Java can handle network data too. I think that Mark's suggestion is to have your c program re-write the HTML every time something changes, rather than have your web-app re-generate the HTML every time someone requests it. Although, having worked with such a system, I can say that it adds complications that probably aren't worth it depending on the number of pages.


I can think of lots of better things than a straight C lib to Java connection. One would be to save the data in a database, then fetch it from there. JSP would be ideal for serving data in this case.

No, the data must come in from an existing network connection, existing C libraries. I need to get that data into a web page and if the data changes every 90ms, then the page needs to show those same changes. A database should not be in the mix here, though there is one elsewhere, but the incoming data is considered real-time data.
Databases can handle real-time data. Unless a delay of 10ms is unacceptable, in which case you probably shouldn't use a network in the first place.


But what you are proposing has lots of funny corners that may not make for a clean solution. Is the C lib multi-threaded, for example? There could be a nasty surprise for you if the C lib not very carefully written for access by multiple threads. Saving the data elsewhere (in HTML, for example, or to a database) breaks this dependency (and that's a good thing).

The C libs are fine and deliver data fine. This is a must and this is how the data arrives into the web server.

I'm not proposing anything, however, I'm thinking an applet is the only way that will do it. I'm asking to see how others have shown or would show data rates that come in this quick in a web page, how to update this part of the page this quickly.
Ah. so perhaps we all misunderstood what you wanted...

When a user connects to your web-app, they download the latest HTML available. We all assumed you wanted to serve them with the most up-to-date info at that time, but it sounds like you want their browser to continuously update without them having to refresh the page. There are several ways to achieve this, but the techniques involved are orthogonal to the use of JNI to retrieve data.

One technique in particular is to use cometd (google it), cometd is a bit like push-based AJAX. The browser has a waiting connection, and when the server knows there is new information, it sends it "immediately".

The other technique involves having a client application (either applet, flash, or activex) that will connect to the server using a specific protocol, and listen for the data then.

So, have I understood your problem correctly? There are two ways to interpret what you've said so far, so please clarify exactly which way you meant:
a) User gets up-to-date information at request time, but needs to refresh to get new data.
b) User gets up-to-date information at request time, and it is kept up-to-date automatically.

Two very different problems that sound similar.




--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
.



Relevant Pages

  • Re: [FAQ] addslashes() and striplashes()
    ... How do I use addslashes() and stripslashes() when dealing with HTML ... Use addslasheswhen INSERTing or UPDATEing data into the database. ...
    (comp.lang.php)
  • Re: Virtual SBS server
    ... I have been posting in HTML since I became an MVP for SBS 5 years ago. ... With regard to Outlook over HTTP, it might be a bit faster since you don't have the VPN overhead to contend with. ... >>Depending on the database VPN may work, ... >desktop so making the server do all the work would be ...
    (microsoft.public.backoffice.smallbiz)
  • Re: following radio & hidden does not work..... help please.
    ... So you query the database for records and present the concatenated fname and lname for the user to choose from. ... This works the same with a radio button or a select statement. ... This is a HTML or PHP question! ...
    (alt.html)
  • Re: Problems with HTML Imports
    ... > fixes or workarounds, I sure would like to know. ... > When exporting data in html from one database that includes the "time" ... Why you are using HTML format to transfer data between databases? ...
    (comp.databases.ms-access)
  • Re: Photographs in British Naturism
    ... source code file, html, jsp, php or what ever), the only factor is ... not to the server if it's serving a html file, ... Currently, it's programmed to generate HTML pages from the text which operators have typed into the database through the admin interface. ...
    (uk.rec.naturist)