Git Product home page Git Product logo

ci-chat's Introduction

Codeiginter FB like Chat library

http://anantgarg.com/2009/05/13/gmail-facebook-style-jquery-chat/ i have converted this chat to codeigniter library. to use in Codeigniter.

You must first create a mySQL table as below.

CREATE TABLE IF NOT EXISTS `chat` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `from` varchar(255) NOT NULL DEFAULT '',
  `to` varchar(255) NOT NULL DEFAULT '',
  `message` text NOT NULL,
  `sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `recd` int(10) unsigned NOT NULL DEFAULT '0',
  `from_name` varchar(100) NOT NULL,
  `to_name` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

How to use?

Set the session variable:

@session_start();
if( !isset( $_SESSION['chatusername'] )  || !isset( $_SESSION['username'] )  ){
    $_SESSION['chatusername'] = 'User 2';
    $_SESSION['username'] = '2';
}

Add the following CSS to your page template

<link type="text/css" rel="stylesheet" media="all" href="css/chat/chat.css" />
<link type="text/css" rel="stylesheet" media="all" href="css/chat/screen.css" />

Add the following scripts to your page template

<script type="text/javascript" src="js/chat/jquery.js"></script>
<script type="text/javascript" src="js/chat/chat.js"></script>


And in the view
<span onclick="javascript:chatWith('2','User 2' )">chat with User 2</span>

Features

  1. Gmail style bottom right display of chat boxes
  2. Keeps chat boxes open and stores state (data) even when pages are browsed/refreshed similar to Facebook
  3. Displays “Sent at…” after 3 minutes of inactivity
  4. Displays “X says…” & blinks chat boxes when window is not in focus
  5. Minimize and close chat boxes
  6. Auto-resize of text input box
  7. Auto-scrolling of chat text
  8. Auto-back-off polling policy (hits the server less-often when chat activity is low)
  9. Extremely simple to integrate into existing site

ci-chat's People

Contributors

abuzer avatar abuzer-firdousi-confiz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.