Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 7

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
Level 7

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
Highlighted
Level 7

Re: How to generate an event?

Thank you Trevor, I'm going to take a look at that! Smiley Surprised))
0 Kudos