Pages: [1]   Go Down
Author Topic: webserver - doubts  (Read 924 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to better undestand the webserver concept regarding arduino boards:

I am using the Arduino Ethernet board right now (later the MEGA+ETH Shield) and the webduino library.

I am including right now the jquery.js file in this way:

Code:
P(http200Ok) ="HTTP/1.1 200 OK";
P(httpContentJavascript) = "Content-Type: application/javascript";

void loadJS(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete){
  server.printP(http200Ok);
  server.println();
  server.printP(httpContentJavascript);
  server.println();
  server.println();
  myFile = SD.open("jquerym.js", FILE_READ);
  int16_t c;
  while ((c = myFile.read()) >= 0) {
    server.print((char)c);
  }
  myFile.close();
}

The file is about 90KB and it takes too much time to load it.

Is there any better way to menage this? Maybe reading more bytes o others solutions?

I cannot connect the board to internet:
Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>

Is there any lighter verion of this? I tried the mobile version but the result is tha same...

How do U menage this?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49035
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The file is about 90KB and it takes too much time to load it.
What file is? Are you referring to jquerym.js?

Quote
How do U menage this?
Don't use java scripting.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What file is? Are you referring to jquerym.js?
yes, this:
Code:
http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js

Quote
Don't use java scripting.
So what do U use for this? like reload part of the page and easy little graphs?

thanks!
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49035
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So what do U use for this?
For one thing, I use proper spelling, like "you". This is not a texting chat room.

Some context for what you are trying to do would be appropriate.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1) I need the capability to control some output in funcion of a scheduler file that I read from the SD card during the setup() function.
2) I also have to read sensors and log it.

So:
1) I'd like to reload part of the page to keep the valued updated (almost every second)
2) display the trend of data by clear and easy graph
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49035
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So:
1) I'd like to reload part of the page to keep the valued updated (almost every second)
2) display the trend of data by clear and easy graph
Not exactly what a browser was designed for. But, there have been all kinds of enhancements made to support all kinds of uses. Of course, they come at a price.

One way around the "problem" is to link to the javascript from some other server. The Arduino should be serving data, not images and scripts and videos. While it can, it will be ssslllooowww doing so.

Your served page may need a java script to function properly. That java script does not have to be served by the Arduino.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1.
Quote
Not exactly what a browser was designed for. But, there have been all kinds of enhancements made to support all kinds of uses. Of course, they come at a price.
What kind of hardware do you think is proper to do this? I would like have only one device and not a linuxbox connected to an arduino board...

2.
Quote
One way around the "problem" is to link to the javascript from some other server.
Yes, but I cannot count on other device on the network.

So about the reload data I think the only way is a <META> on the html and about the graph... this can be menaged by other server, just getting data from arduino.
Or maybe is there any proper device? (see point 1.)
thanks again.

Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1018
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The <canvas> of HTML5 can do graphs updates without updating the page. The data for the graph can be retrieved in a small javascript. It should be possible to keep the size very small, so the Arduino Webserver can upload it from the SD card without a long delay.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will check.
Thanks!
Logged

Pages: [1]   Go Up
Jump to: