CodeIgniter Forums
can we implement Live chat using CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: can we implement Live chat using CI (/showthread.php?tid=5503)



can we implement Live chat using CI - El Forum - 01-24-2008

[eluser]Nagabhushana[/eluser]
Hi,
please help me how to implement Live chat using CI, if not possible with CI, tell me the alternate solution..
thank u


can we implement Live chat using CI - El Forum - 01-24-2008

[eluser]Sarre[/eluser]
For this you probably want to use javascript, and especially AJAX (that allows you to update a part of your page, without refreshing the whole page, so it's what you need for a chatbox)

Many javascript libraries help make your life easier when building such an application.
Mootools, JQuery, YUI, Prototype, Dojo,... are keywords you might want to try in google ;-)

You can combine this with codeigniter. Use a javascript function that updates a div with information from your database (through codeigniter-MCV), and make it work periodical (e.g. so that every 5 seconds it updates the div). Use an input-element to enter text, and use javascript to hijack the event, and instead use ajax to send the text you entered to a controller that enters it into the database.
The periodical updating div will after a few seconds show your response in that div.

This is of course a very basic chatbox method...
But questions should rather be asked on the forums/mailinglists of the javascript libraries, as they're the specialists! Smile

If this all sounds like Chinese, go take a look at e.g. mootools.net, my personal favorite.

Greetz.