Forum Moderators: open

Message Too Old, No Replies

trying to find workaround for ajax "listener"

         

distorto

4:30 pm on Mar 12, 2008 (gmt 0)

10+ Year Member



I'm building a jabber client to handle instant messaging on a site I'm working on. I did a proof-of-concept version of the chat client using ajax and php/mysql. The system "listens" for chat requests - ie: I have a repeating db query that looks for chat requests with the current user's name. If the current user's name is found in a request, the user accepts that chat and we pop open a little chat window.

I would like to figure out a way to avoid the repeating db calls checking for chat invites. I mean, is there any way to "push" data with ajax to a specified user's session? I can't immediately think of any way to avoid having the "listener" sitting there hitting the db all the time, but I thought I'd see if anyone out there might have an idea. Once my jabber system is setup, this problem will be history, but for now, each user on the system is constantly hitting the db while they are logged on, which I don't like.
any ideas?

distorto

5:01 pm on Mar 12, 2008 (gmt 0)

10+ Year Member



ok, I found some interesting stuff and it seems this is indeed solvable. event driven ajax; comet; "reverse ajax" - as an approach; "pushlets" I assume are java.
I find this stuff very neat. I would still love to hear people's thoughts if anyone has experience in the area. Maybe this is not so much a php topic anymore, though.