Login   Register  
Icontem

File: ReadMe.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of PLSCIS PLP  >  jQuery HTML5 Websocket or AJAX Chat  >  ReadMe.txt  >  Download  
File: ReadMe.txt
Role: Documentation
Content type: text/plain
Description: Readme file
Class: jQuery HTML5 Websocket or AJAX Chat
jQuery Chat plugin using Websockets or AJAX
Author: By
Last change: Added link for php html5 websockets library
Date: 2013-12-09 09:35
Size: 923 bytes
 

Contents

Class file image Download
Code to initialize object:
var ms = new $('#msgchat').jqh5ajx({ msg_link:server_url, clbk_fnc:'setchatdtls' });

where server_url is the server url to call, and setchatdtls is the callback function. 

Code to send data using websocket:
// use this condition to make sure it is using websocket connection
if(typeof ms.mcevs != 'undefined' && ms.mcevs != null && typeof ms.chattype != 'undefined' && ms.chattype != null && ms.chattype == 'ws') {
    ms.send('text');
}

Code to close websocket connection:
// use this condition to make sure it is using websocket connection
if(typeof ms.mcevs != 'undefined' && ms.mcevs != null && typeof ms.chattype != 'undefined' && ms.chattype != null && ms.chattype == 'ws') {
    ms.close();
}

For handling web-sockets, can use any php web-socket server library like:
1) Ratchet PHP Web-Sockets library (http://socketo.me/)
 OR
2) https://github.com/Devristo/phpws