Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
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)
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,
0 Kudos
2 Replies
Level 7

Re: How to generate an event?

Here's an example:
*** Trevor Anderson - - ***
0 Kudos
Level 7

Re: How to generate an event?

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