Thanks Rey -
I'll look into these links this evening. So far with a little bit of
experimentation, I've been able to make a SSAS file that simply runs
a really long loop, and then responds when it's done. So my ideas so
far kind of look like so:
function getEvents() {
// run query and get length of results
result = CF.query(blah, blah);
while(!result.length) {
result = CF.query(blah, blah);
}
// if we get here, we have new events...
// run query to delete events for next request, then return results
to client
return result;
}
I'm thinking that I can slow this down by using a timer, and only
checking the db for new events say every 30 seconds, instead of doing
it in the loop. The important thing though seems to be blocking the
return until I have some data.
Does anyone see any problems with this approach? I'm guessing each
request runs in it's own thread, so as I scale up the number of
clients connected, this might hurt things.
Thanks,
John
On Jun 7, 2007, at 11:36 AM, Rey Bango wrote:
> John,
>
> I've not had experience with this but it does sound like some type of
> threading may help and CF8's or BD's CFTHREAD tags may do the trick. I
> know that comet is used in JavaScript client-side implementations
>
> I use jQuery for client-side work and the jQuery Ajax/JS library does
> have a plugin to work with Comet. You can find that here:
>
> http://empireenterprises.com/_comet.html
>
> This jQuery plugin also does server polling:
>
> http://www.jasons-toolbox.com/JHeartbeat/
>
> And here's an article explaining more about Comet:
>
> http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications
>
> HTH.
>
> Rey..
>
>
> John Robinson wrote:
>> Hello!
>>
>> I've been asked to develop a chat application using CF and Flash. I
>> recently finished a front-end to a project with a proprietary backend
>> that was similar but I don't have access to it, and don't know what
>> server tech. they were using. Basically, the chat client would send
>> an http request to the server and the server would hold onto that
>> request until new messages were available (or the request timed
>> out... about 60 seconds) before it responded. At that time, I'd
>> simply make a new request, where the process would repeat itself.
>> They told me this process is referred to as "long polling" or
>> "comet". I searched a bit yesterday but couldn't find anything
>> related to CF. Can anyone confirm that this is possible in CF, and
>> perhaps post a code example?
>>
>> Thanks,
>>
>> John Robinson - Flash/Flex Developer at large
>> Blog: http://jrobinsonmedia.wordpress.com
>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280426
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4