Shop OBEX P1 Docs P2 Docs Learn Events
Webpage Content Question — Parallax Forums

Webpage Content Question

th3jesterth3jester Posts: 81
edited 2010-11-20 19:50 in Accessories
I am still waiting for the Spinnernet but I have been going through the example code in the OBEX. Simple question:

Will the quotations in the below code cause an error? The HTML, <META HTTP-EQUIV="REFRESH" CONTENT="5">, is a simple automatic refresh but with the Propeller Tool it changes the color which makes be think it won't work properly.

StringSend(0, string("<META HTTP-EQUIV="REFRESH" CONTENT="5">", PST#NL))

I'll be able to test it once I get the Spinnernet, I'm just seeing if anyone knows off the top of their head.

A little harder question:
Do you think the Spinnernet will be able to perform Comet/Ajax/HTTP-Streaming? This would be helpful for not having to constantly update the whole page, the specific data would be real-time (lets say from a sensor). I'm not expecting someone to program it out or figure it out, I'm just curious if anyone thinks this is reasonable.

Thank You.

Comments

  • David CarrierDavid Carrier Posts: 294
    edited 2010-11-08 16:58
    th3jester,
    The quotation marks will end the string early. The quickest workaround would be to do this:
    StringSend(0, string("<META HTTP-EQUIV=", $22, "REFRESH", $22, " CONTENT=", $22, "5", $22, ">", PST#NL))
    
    The hex value for the quotation mark is 22, so the above example will include value for the quotation mark instead of the mark itself. A better way to do it is this:
    Pub x
    ...
    StringSend(0,@WebPage)
    ...
    DAT
    WebPage file "Index.html", $00
    
    This will include the Index.html file, followed by a null, in the DAT section. Using @WebPage will pass the address to StringSend.

    — David Carrier
    Parallax Inc.
  • obrienmobrienm Posts: 65
    edited 2010-11-20 19:50
    Th3Jester,
    Yes, AJAX streaming sensor reading is doable. Here is an AJAX proof of concept using Timothy's modified TCP Server demo. The demo is very basic, but illustrates asynchronous get requests from the XmlHttpRequest object on the browser client to an XML serving process on the Spinneret.

    Google YouTube video of the Spinneret, Chrome browser, PST and use of the mouse-over and start/stop timer buttons for the AJAX POC

    http://www.youtube.com/watch?v=sNTTufau7ws

    Note: Use of the XmlHttpRequest object is heavily browser dependent, Google and IE8 are normally fine running the demo. The video was done on Google Chrome.

    Dynamic Application Server main thread contains the modified source
    http://forums.parallax.com/showthread.php?p=955667#post955667


    thank you
    /michael
    th3jester wrote: »
    I am still waiting for the Spinnernet but I have been going through the example code in the OBEX. Simple question:

    Will the quotations in the below code cause an error? The HTML, <META HTTP-EQUIV="REFRESH" CONTENT="5">, is a simple automatic refresh but with the Propeller Tool it changes the color which makes be think it won't work properly.

    StringSend(0, string("<META HTTP-EQUIV="REFRESH" CONTENT="5">", PST#NL))

    I'll be able to test it once I get the Spinnernet, I'm just seeing if anyone knows off the top of their head.

    A little harder question:
    Do you think the Spinnernet will be able to perform Comet/Ajax/HTTP-Streaming? This would be helpful for not having to constantly update the whole page, the specific data would be real-time (lets say from a sensor). I'm not expecting someone to program it out or figure it out, I'm just curious if anyone thinks this is reasonable.

    Thank You.
Sign In or Register to comment.