lmsilva
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2012
07:19 PM
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
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
2 REPLIES 2
Trevor
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2012
12:00 AM
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 ***
lmsilva
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2012
09:18 AM
Re: How to generate an event?
Thank you Trevor, I'm going to take a look at that! :o))