Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lmsilva
Visitor

How to generate an event?

Dear all,

I'm doing some tests and I want to asynchronously call a web server and generate an event when a certain type of data is received.
In essence, I want to, ideally, be able to maintain an open connection to a web server and wait for it to push information back to me. When it does, I want to generate an event that my code can pick up and act on.
Worst case scenario, I want to be able to make this asynchronous call every X seconds and act on it.

For now, I have done this in an EventLoop function:
while true
msg = wait(0, m.port)
xfer.SetURL("http://192.168.1.52/roku/getdata.php)
num_value = strtoi(xfer.gettostring())

But this OBVIOUSLY doesn't scale as my web server is getting hit several times per second.

Any ideas on how I do this in a scalable way?

Thank you,
Luis
0 Kudos
2 REPLIES 2
Trevor
Visitor

Re: How to generate an event?

Here's an example: http://forums.roku.com/viewtopic.php?f=34&t=47659&start=30#p327128
*** Trevor Anderson - bloggingwordpress.com - moviemavericks.com ***
0 Kudos
lmsilva
Visitor

Re: How to generate an event?

Thank you Trevor, I'm going to take a look at that! :o))
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.