Friday, April 15, 2011

SIP: Teacup + RedTea

  So I've been playing around with MOAP and LSL's HTTP-in, which lets you not only display media inworld, but also serve it from there to the Outside world as well...

  Thanks to the work of several people. We can now align/resize the window by script, use "data: URNs to feed non-plain-text content to the window, even using it to wrap things like videos, and.... bootstrap plain text content into HTML pages...

And that's where I've been looking to make improvements. Currently there are two freely available methods for bootstrapping; One uses huge "data:" URN wrappers for all links, but supports mostly normal click through behavior. Unfortunately, at ~three hundred+ bytes per link, you won't be putting many links on your pages. And not all external browsers may support it (I know Firefox does though). The other chooses to hot load the "data:" URN wrappers from the script which can support bigger pages (no huge links), but resets the view for everyone to the last link clicked (could be a good thing in some cases). And completely falls apart outside of prim media (can't be used in the internal browser or external browsers)

Those Methods are vast improvements over the simpler limits we had, but neither is really a good media server

The Goal:

  • Use lsl HTTP-in to serve MOAP, without any external resources, using simple standards based methods. A Server In a Prim or SIP.
The Hurdles:
  • Viewer doesn't pass "data:" URN's to external browsers (even when supported)
  • ll*PrimMedia* Commands are slow (1 sec pause for each call)
  • Script-size (with code) limits page-size drastically
  • HTTP-in can only serve plain text data
The Workarounds and their limitations:
  • Wraping pages in data URNs
    • (+)Gets the html onto the page
    • (-)Requires slow media commands
    • (-)Does not work in internal/external browser
  • Wraping links in "data:" URNs:
    • (+)Gets the link html onto the page
    • (+)Works on internal/external browser
    • (-)links are HUGE taking up valuable space
  • Wraping pages in java script
    • (+)Gets the html onto the page
    • (+)Works on internal/external browser
    • (-)Only get a single page from loading
    • (-)Requires one of the "data:" URN wrapper methods

  Enter the Teacup Server; a next step improvement building on the current methods. A single call of the Prim Media commands, which loads a single initial page, no massive links, no over-sized wrappers (page wrapper is < 1/3 of the minimal HTML it replaces). Pages support most of their normal features (HTML, JavaScript, and CSS, with few restrictions), that would be available within the body tag of a page. All in a minimal LSL script allowing it to safely serve content up to 40Kb+

  But you can't have a server without a file system to fetch from, and you can't have a Teacup without Tea, so I've also coded a simple yet solid example called Red Tea. Red Tea let's you drop notecards in with page content, then it reads the notecards, makes the changes necessary for JavaScript wrapper compatibility, and stores them until the server asks for them. As a bonus, if Red Tea doesn't have a file, it tells the server so that the server can send the appropriate code right away, so that page loads aren't held up by missing content.

  "Yeah all this talk is nice, but where is the code?" a Very smart question, and the answer is to click on image below wherever you see it. =)

2 comments:

Gareth said...

WELL...

This is a nice post...


I appreciate your writing.

Lisa said...

Nice one...

It seems need to work hard in this.