After reading the revUp article "Cool Cat Server" from David Williams here:http://newsletters.livecode.com/november/issue160/newsletter1.php
I was wondering
if it is possible to take a snapshot of a stack running on a server
and directly interact with the snapshot from within a browser.
I wanted to find out what could be done (jus a fun project) and came up with a
stack containing two cards.
Since I had some graphics laying around from a previous project (iPhone) I used them,
to create the stack and the html (.lc) page.
How does it work:
The stack runs on the server and is never saved.
You could save the stack but then a new user would start with the
changes of the previous user. I decided to have a model where the stack is not saved.
Every user gets a new session (a fresh stack), necessary variables are stored on the server for
every session in what is called session variables. This makes it possible to have many concurrent
visitors, each independent of every other !
The buttons on the stack are actually images which are used as HTML maps
and trigger the relevant LiveCode scripts in the stack script.
I also wanted to try to download content from a different server (e.g. pictures)
and display it in my stack, this led me to the idea of making the mini game
on card one.
Card two just displays some environmental variables.
I hope that other people with more HTML5/Ajax knowledge can come up with smarter ideas
how to use this concept.
See it in action here:http://serverstack.kangaroo.on-rev.com/stack_on_server.lc
My goal was just a proof of concept. It helped me understand the interaction between stacks and server, and
I learnt a lot of new HTML5 commands and a lot about LiveCode Server.
If you come up with other ideas how to use this concept then please post your stacks
or links into this thread !
PS: You need to put the image bg_overlay_iphone_bg.png into the folder called images (because of the 256kb upload limit I had to separate it)
PS2: If the update of HTML pages are slow at times then wait until I upgrade to a newer iPhone