I need a basic example of using a "Streaming App"
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
I need a basic example of using a "Streaming App"
In more than one post, Richard Gaskin has described a Streaming app (one example of a thread that touches on this: http://forums.livecode.com/viewtopic.ph ... 2&p=146017 )
Has anyone out there in Livecode land used this method successfully? If so, are you willing to post a basic example of this?
There is an example in Livecode 8, under plugins>GoLiveNet which is really great, but the script that downloads the stack and uncompresses it is rather complex and I would just like to do a simple starter for this before I attempt additional features. I picked through it a bit but have not quite managed to unlock the secrets just yet. I need a little help.
I have a remote server with Livecode 8 server on it. What will my script look like that downloads and opens the stack on my server, and then closes it when through?
Any help is appreciated!
Has anyone out there in Livecode land used this method successfully? If so, are you willing to post a basic example of this?
There is an example in Livecode 8, under plugins>GoLiveNet which is really great, but the script that downloads the stack and uncompresses it is rather complex and I would just like to do a simple starter for this before I attempt additional features. I picked through it a bit but have not quite managed to unlock the secrets just yet. I need a little help.
I have a remote server with Livecode 8 server on it. What will my script look like that downloads and opens the stack on my server, and then closes it when through?
Any help is appreciated!
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: I need a basic example of using a "Streaming App"
I should simplify that. It's old code that used to do more than it now needs to, and is needlessly complicated. My apologies.ghettocottage wrote:There is an example in Livecode 8, under plugins>GoLiveNet which is really great, but the script that downloads the stack and uncompresses it is rather complex and I would just like to do a simple starter for this before I attempt additional features. I picked through it a bit but have not quite managed to unlock the secrets just yet. I need a little help.
Here's an exercise to get you started:
1. Upload a LiveCode stack file to a server
2. In your local Message Box, type
Code: Select all
go url "http://www.yourdomain.com/path/to/file.livecom"
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: I need a basic example of using a "Streaming App"
Okay. I am kicking myself just now.Here's an exercise to get you started:
1. Upload a LiveCode stack file to a server
2. In your local Message Box, type
Code: Select all
Select all go url "http://www.yourdomain.com/path/to/file.livecom"
You had actually posted the same code in another thread, and I was trying that, and many variations with no luck. I figured I was missing some vital piece of information..
Turns out that I had added some rules in my .htaccess to prevent access to the stacks folder, and forgot to remove those rules when it came time to start working with the stacks.
I just removed those rules and my stacks pop-up immediately from that code.
Thanks!! Next time I will double check my server configuration before posting.
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: I need a basic example of using a "Streaming App"
Just exploring the idea, and looking through your code, how far down would you simplify that if you were re-doing it?I should simplify that. It's old code that used to do more than it now needs to, and is needlessly complicated. My apologies.
It looks like it has some checks in case the download fails, or someone cancels the downloads, and then moves the launcher stack to the background and sets the downloaded stack to the front, and then some other things that I do not understand that look terribly impressive.
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: I need a basic example of using a "Streaming App"
...have been spending more time playing around with the idea. I have to say this works very well, and has many advantages over having a static file that needs to be updated on every device it runs on.
Is there any down-side? I am trying to think through any possible issues:
Is there any down-side? I am trying to think through any possible issues:
- *Since the application I am building relies on a remote database, it requires a connection regardless, so not being able to launch if there is no internet is not an issue.
- *For security, I have this particular server only accessible via VPN, so the stack on the server is not publicly available.
- *If I understand this concept correctly, the stack is downloaded temporarily to each device that opens it, so multiple people using it at once will not be an issue.
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: I need a basic example of using a "Streaming App"
VPN is a good option. In most of the projects I've used this on I also need authentication and other backend services, so I keep the stack files outside of the web root folder and serve them as binary files from an LC Server CGI.ghettocottage wrote:
- *For security, I have this particular server only accessible via VPN, so the stack on the server is not publicly available.
Yes, when a stack us loaded from a remote source it has no file name and exists only in RAM. And like a web page or most other network-delivered resources it's a copy of whatever's on the server, so each user has their own copy and they don't interfere with one another.
- *If I understand this concept correctly, the stack is downloaded temporarily to each device that opens it, so multiple people using it at once will not be an issue.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: I need a basic example of using a "Streaming App"
@FourthWorld
I know this is an old thread, but I was wondering if you could elaborate a little on this comment that you serve the Livecode Stack as a binary file. Do you mean that you use a file-server rather than web-server on the VPN to serve the stacks?
Richard,VPN is a good option. In most of the projects I've used this on I also need authentication and other backend services, so I keep the stack files outside of the web root folder and serve them as binary files from an LC Server CGI.
I know this is an old thread, but I was wondering if you could elaborate a little on this comment that you serve the Livecode Stack as a binary file. Do you mean that you use a file-server rather than web-server on the VPN to serve the stacks?
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: I need a basic example of using a "Streaming App"
Web server. Given the lightweight simplicity of HTTP I rarely use anything else.
Just as a web server can read image files from disk and send them over the wire to the requesting client, they can deliver any other binary data the client app can handle. When that client is made with LC, stack files are a natural fit.
I'd you'd like I can turn up my version is mchttpd, socket server that handles HTTP. It's not great for production except maybe in very specialized setups, but it's a great way to learn how HTTP works so your can later use Apache, Lightly, Nginx, or anything else with confidence.
Just as a web server can read image files from disk and send them over the wire to the requesting client, they can deliver any other binary data the client app can handle. When that client is made with LC, stack files are a natural fit.
I'd you'd like I can turn up my version is mchttpd, socket server that handles HTTP. It's not great for production except maybe in very specialized setups, but it's a great way to learn how HTTP works so your can later use Apache, Lightly, Nginx, or anything else with confidence.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: I need a basic example of using a "Streaming App"
Yes, that would be great. So far I have a launcher app that uses:I'd you'd like I can turn up my version is mchttpd, socket server that handles HTTP. It's not great for production except maybe in very specialized setups, but it's a great way to learn how HTTP works so your can later use Apache, Lightly, Nginx, or anything else with confidence.
Code: Select all
on openStack
go url "https://db.myserver.com/stacks/db.livecode"
close stack "launcher"
end openStack
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: I need a basic example of using a "Streaming App"
Do you have LiveCode Server or other flexible scripting language set up as a CGI on your server?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: I need a basic example of using a "Streaming App"
Indeed I doDo you have LiveCode Server or other flexible scripting language set up as a CGI on your server?
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: I need a basic example of using a "Streaming App"
Your CGI script can just read the file. Use binary mode, then just send it back to the requesting client using "put" like you would any other data.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: I need a basic example of using a "Streaming App"
Sorry, I have been experimenting but cannot seem to make this work. Can you give me an example of what the CGI script might look like?FourthWorld wrote:Your CGI script can just read the file. Use binary mode, then just send it back to the requesting client using "put" like you would any other data.
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: I need a basic example of using a "Streaming App"
Code: Select all
put url ("binfile:path/to/somestack.livecode) into tStackData
-- Always check for errors with file I/O:
if the result is not empty then
put "Error: "& the result &&"("& sysError() ")"
quit
end if
-- Deliver the goods:
put tStackData
quit
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: I need a basic example of using a "Streaming App"
That works!
I was very close with the script I was trying, but I had to set permissions on the parent folder of where my external files are so the apache-user could have access (where webroot is /var/www/webroot and stacks are at /var/www/stacks)
fixed with
chown -R www-data:www-data /var/www &&chmod -R 775 /var/www
and now the CGI script loads the stack from a folder outside of the web-root.
Thank you so much!
I was very close with the script I was trying, but I had to set permissions on the parent folder of where my external files are so the apache-user could have access (where webroot is /var/www/webroot and stacks are at /var/www/stacks)
fixed with
chown -R www-data:www-data /var/www &&chmod -R 775 /var/www
and now the CGI script loads the stack from a folder outside of the web-root.
Thank you so much!