Welcome Guest, Not a member yet? Register   Sign In
Event Driven Application (COMET)

[eluser]Dregond Rahl[/eluser]
I recently was flipping thru some information about event driven applications and how it is bettr than using direct AJAX, because with AJAX you have to set a timeout an such. I found a site using an Event driven system.


on first view it seems like normal AJAX but you'll find it doesn't send requests unless the next person is typing or actually sent a msg. Im damn curious how we could archive this using CI or if any other framework would be needed.

Thanks for any insight into this.

[eluser]Phil Sturgeon[/eluser]
AJAX and JavaScript are nothing to do with CodeIgniter. Read up on jQuery which is a brilliant JavaScript library that will allow you to very easily create AJAX requests based on Events.

It is all in the documentation and gives very good examples, so you should be up and running in not time.

[eluser]Dregond Rahl[/eluser]
I know they have nothing to do with CI, but COMET and Event driven Applications require sever side coding. I don't mean the onmouseover events and such, I mean like sever push and long polling and such based on events that happen like sending messages or typing, and only then will AJAX and such make a call for information, not consistently checking.

[eluser]Phil Sturgeon[/eluser]
Well, when a user is typing you would use the "onkeyup" event, and when sending messages you would use the "onsubmit" event.

These are handled in jQuery via $('#item').submit() and $('#item').keyup(). CodeIgniter has nothing to do with user interaction on the client side. AJAX requests are made to CodeIgniter the same as any other PHP application.

That may be of interest to you. Has an example of it too. (have it at www.trackgigs.com/chat ) can try it between two browsers.

Here is an idea I have heard before.

In PHP, you create a file with randomly generated name and write "0" to it. You send the file name to jQuery. jQuery can keep polling the file at fixed intervals to see if its contents have changed (!= "0"). At the end of the request you can delete the file.

This can be faster because PHP is bypassed and Apache serves the file directly.

[eluser]Dregond Rahl[/eluser]
@ Phil Sturgeon, intervals are still there like 1 second or 5 seconds delay checking if the other user sent a msg or not. what i mean is real time applications and event driven ones that are server side, so when someone sends a msg everyone gets it. It complex to explain its called "server push" or COMET. its server side not client side.

@ garymardell, thanks for the link ill look into that

@ vendiddy, it would be the same as normal AJAX using push technology and COMET intervals wont be needed information will be updated only when it needs to be so checking of the file wont be needed over and over across intervals.

Thanks for everyone replies, push technology is relatively new for normal web based applications so its quite hard to figure out.

i'm trying to set an XMPP server / JS client, it use the same "method" of comet ( persistent connection , not post/get requests )...but it's a standard that supports many protocols ( gtalk and facebook use this )...like msn , icq, etc ... it's not running yet, but when it's done...i will post a tutorial

[eluser]Dregond Rahl[/eluser]
that would be awesome =]
will you be using any sort of push server software? like Twisted ?

in fact, i'm trying with a XMPP server, openfire and ejabberd are my options

Theme © iAndrew 2016 - Forum software by © MyBB