Re: [WebDNA] HTTP Streaming - POSSIBLE!
This WebDNA talk-list message is from 2010
It keeps the original formatting.
numero = 105557
interpreted = N
texte = I wrote a DNA program that displayed a scoreboard to screens placed throughout an arena for an indoor soccer league. Every time the scoreboard was updated by the referee (score, timeout, qtr, etc.) - so upon every post, a new file was written into a directory. The name of the file was[text]thenextvar=[math]0[listfiles ../thedir/]+1[/listfiles]+1[/ math].txt[/text][writefile ../thedir/thenextvar]could put the time or dynamic info that the client side script might use[/writefile]So it kept creating a sequential file names1.txt2.txt3.txtetc.Then I had the video networked computer displaying the scoreboard webdna page.Which included a script that reloaded itself upon the creation of the next sequential file.[text]thenextvar=[math]0[listfiles ../thedir/]+1[/listfiles]+1[/ math].txt[/text][waitforfile file=../thedir/[thenextvar]][!]don't use a timeout...[/!][redirect index.tpl?tt=[date][time]][/waitforfile]This is a pretty rough example, just trying to convey the concept.I'm a freelance webdna programmer with more than a decade of experience.If you need more help or want me to write it for you, I'd be happy to help....Sincerely,Scott Waltersscott@ideassoftware.comOn Jul 11, 2010, at 6:58 PM, Kenneth Grome wrote:> Has anyone actually done HTTP streaming in webdna?>> My understanding of the basic concept is that the server receives a > request from the browser, then it keeps the connection open via a > long running (or infinite) loop of some kind, and then it > periodically pushes new data to the outgoing stream and flushes the > stream -- without closing the connection.>> I can create a loop in webdna with no problem, but how do I flush > the periodic data to the stream without the server closing the > connection? I have tried this as a test:>> [loop start=1&end=10]> [waitforfile file=doesNotExist.txt&timeout=2][/waitforfile]> [writefile textFile.txt][time][/writefile]> [include textFile.txt]
> [/loop]>> ... but of course this does not work because the page is not > rendered until after the loop stops running. I get these results > all at once, but what I actually want is one line at a time pushed > to the stream/browser every 2 seconds:>> 17:39:36> 17:39:37> 17:39:39> 17:39:40> 17:39:41> 17:39:42> 17:39:43> 17:39:45> 17:39:46> 17:39:47>> I know a lot about webdna, but at the moment I cannot think of a way > to make this work. Can any of you?>> The problem is that webdna does not produce any results or render > the page until ALL the code on the page has been interpreted. Only > then will it send the results to the server -- which then forwards > those results on to the browser and closes the connection.>> Anyone see any webdna-based alternatives here?>> Sincerely,> Kenneth Grome>> P.S. As an aside, my test seems to indicate that the timer in > "waitforfile" is not very accurate. The total time for all 10 lines > to be processed should have been 20 seconds, not 11. Let that be a > lesson to anyone who wants to rely on the accuracy of the > waitforfile timer!>> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list
.> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us>
Associated Messages, from the most recent to the oldest:
I wrote a DNA program that displayed a scoreboard to screens placed throughout an arena for an indoor soccer league. Every time the scoreboard was updated by the referee (score, timeout, qtr, etc.) - so upon every post, a new file was written into a directory. The name of the file was[text]thenextvar=[math]0[listfiles ../thedir/]+1[/listfiles]+1[/ math].txt[/text][writefile ../thedir/thenextvar]could put the time or dynamic info that the client side script might use[/writefile]So it kept creating a sequential file names1.txt2.txt3.txtetc.Then I had the video networked computer displaying the scoreboard webdna page.Which included a script that reloaded itself upon the creation of the next sequential file.[text]thenextvar=[math]0[listfiles ../thedir/]+1[/listfiles]+1[/ math].txt[/text][waitforfile file=../thedir/[thenextvar]][!]don't use a timeout...[/!][redirect index.tpl?tt=[date][time]][/waitforfile]This is a pretty rough example, just trying to convey the concept.I'm a freelance webdna programmer with more than a decade of experience.If you need more help or want me to write it for you, I'd be happy to help....Sincerely,Scott Waltersscott@ideassoftware.comOn Jul 11, 2010, at 6:58 PM, Kenneth Grome wrote:> Has anyone actually done HTTP streaming in webdna?>> My understanding of the basic concept is that the server receives a > request from the browser, then it keeps the connection open via a > long running (or infinite) loop of some kind, and then it > periodically pushes new data to the outgoing stream and flushes the > stream -- without closing the connection.>> I can create a loop in webdna with no problem, but how do I flush > the periodic data to the stream without the server closing the > connection? I have tried this as a test:>> [loop start=1&end=10]> [waitforfile file=doesNotExist.txt&timeout=2][/waitforfile]> [writefile textFile.txt][time][/writefile]> [include textFile.txt]
> [/loop]>> ... but of course this does not work because the page is not > rendered until after the loop stops running. I get these results > all at once, but what I actually want is one line at a time pushed > to the stream/browser every 2 seconds:>> 17:39:36> 17:39:37> 17:39:39> 17:39:40> 17:39:41> 17:39:42> 17:39:43> 17:39:45> 17:39:46> 17:39:47>> I know a lot about webdna, but at the moment I cannot think of a way > to make this work. Can any of you?>> The problem is that webdna does not produce any results or render > the page until ALL the code on the page has been interpreted. Only > then will it send the results to the server -- which then forwards > those results on to the browser and closes the connection.>> Anyone see any webdna-based alternatives here?>> Sincerely,> Kenneth Grome>> P.S. As an aside, my test seems to indicate that the timer in > "waitforfile" is not very accurate. The total time for all 10 lines > to be processed should have been 20 seconds, not 11. Let that be a > lesson to anyone who wants to rely on the accuracy of the > waitforfile timer!>> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us>
Scott Walters
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
[ListFiles] & [loop] (1998)
AcountAutherizer [fixed] (2002)
Version f1 status (1997)
Date problems-more (1997)
(1997)
Plugin or CGI or both (1997)
Separate SSL Server (1997)
SSL/Document Contains NO Data (1998)
Help! WebCat2 bug (1997)
Subtotal Not Calculated on Invoice.html (1998)
Nested tags count question (1997)
WebCat2b12 CGI Mac -- Problems propagating the cart through (1997)
[WebDNA] anyway to speed up tcpconnect? (2008)
WebCatalog/WebMerchant bug? (1999)
searchable list archive (1997)
New Docs (2003)
Security (1998)
WCS Newbie question (1997)
Help! WebCat2 bug (1997)
WebCatalog2 for NT Beta Request (1997)