This chat plugin is AJAX driven so it means that you do not have to reload page to see new
incoming messages.
In the info-bar you can see the AJAX engine progress.
If you have Java enabled you can as well have nice sound notification of new messages, even with sound volume / muting.
There is already a bunch of AJAX chatting modules available out there. So why I made this one
- It started as a improvement of Discussion plugin and ended in fully AJAX driven chat. I wanted
to test the technology and to learn something new.
How to use it
- Just type your message into text field below and hit [Enter]. That's it...
Jump to demo page here.
If anybody wish to test this under own DokuWiki installation, feel free to download it here (version 1.1.2),
Mirror 1 here (version 1.1.2), or
Mirror 2 here (all versions).
As have been said, code is probably not ready yet so it may fail to work for you under some circumstances, especially if you have older DokuWiki version. Improvements shall follow…
Unzip chat/ directory into your DokuWiki plugins folder.
Use included local.php.dist and add its contents to your local.php settings file. Change the values accordingly at your will.
The DokuWiki uses the AJAX tookit library SACK for all AJAX operations.
For the chat plugin to work correctly, you need to update SACK with latest 1.6 version.
I provide in the installation zip updated version of SACK. It is only one file tw-sack.js. You will have to copy this file over the original file in /lib/scripts/ directory.
Original tw-sack.js 1.6 version comes from http://www.twilightuniverse.com/resources/code/sack/ where you can download complete package with documentation and demo.
Original file miss some “;” on the end of declarations and it did not work well with DokuWiki javascript compression. That is the only modification I made.
2007 - 12 - 04 break link for " http://www.twilightuniverse.com/resources/code/sack/ " help please
Chat messages are stored into separate chat namespace under the page where it is included.
So this current page stores chat into :dokuwiki:plugin:chat:chat page. 
Physical file would be data/pages/dokuwiki/plugin/chat/chat.txt
You will have to setup user-rights (ACL) for chat namespace.
When only Read right is set, user can see the messages list but is not allowed to send
the messages.
To include chat on your page, use:
~~CHAT~~
Chat can be included only once per page.
Chat plugin has been developed under latest development DokuWiki version.
If you wish to run it on older versions, you will probably need to do some adjustments:
If your installation does not include
events.js, download it and put it into
lib/scripts directory
Edit
ajax.php and change all occurrencies of
$auth->getUserData(...)
into
auth_getUserData(...)
In case you have access to your server configuration, consider excluding Chat plugin accesses from access.log.
This is how it can be done for Apache2 (example):
SetEnvIf Request_URI "^/wiki/lib/plugins/chat/ajax\.php$" dontlog
SetEnvIf Request_URI "^/wiki/lib/exe/indexer\.php$" dontlog
CustomLog /var/log/apache2/access.log combined env=!dontlog
There are rotating four AJAX checking states:
First, new messages are polled each 5 seconds.
After 30 seconds, checking interval is prolonged to 10 seconds.
After another 30 seconds, checking interval is changed to 30 seconds.
Now, mouse-movement over document window is monitored. If no mouse movement occures on document window in one minute, interval is again prolonged to 5 minutes which is longest checking interval.
Now as soon as any mouse movement occures, checking interval is changed back to
10 seconds and the cycle repeats again.
At any time if something is typed into message box, checking interval is changed back
to fastest 5 seconds immediately.
This logic ensures that if chatting heat goes high, messages are refreshed fast enough
and still if there are no people chatting for some time, the polling cools down so
the web-server is not overloaded with AJAX requests.
You can modify the timings of course, but use common sense here. Although AJAX polling
requests and responses are short chunks of data and usually complete very quickly,
if there is a lot of users that have the page with the chat plugin open in browser,
enough traffic can be generated to bring your server to its knees. So use it wisely…
It is also advised to use some sort of PHP accelerator on the server side to improve
performance1).
2006-11-8, Version 1.1.2
Security: Limited length of Name field to 30 characters.
Security: Limited length of Message field. Can be specified in configuration
Security: Filtering of Name field. Now it can consist of alphanumeric characters, dashes, underscores, dots or spaces only.
Added audio-notify setting into configuration.
Fixed cookies handling to work with newest DokuWiki
-
2006-2-21, Version 1.1
Optimized sent data, really only new messages are transferred
Limited sending rate so it is not possible to send more than 1 message per second
Added $conf[’chat‘][’show-progress‘] for enabling info bar
[Clear messages] button is now visible for logged-in user that has edit rights for current page
Improved user-rights handling, now user must have write-rights for chat page to be able to see [Send] button and chat prompt.
More small fixes
2006-2-20, Version 1.0
Added user rights checking
Added “Loading messages…" text on initial page load
Added error messages when user has insufficient rights
I noticed servel bugs in your code:
in the local.php.dist file, all variables concerning boolan values are not boolan in your case but only strings. It should be TRUE odr FALSE instead of ‘true’ oder ‘false‘.
in chat.php concerning the html-tag “param” you did forgot the / at the end for xhtml-compatibility.
in chat.php you use the date()-function to allocate a unique username in a wrong way.
Thank you for this plugin. It work great when I call it but I have a weird error on others namespaces.
I have a namespace with subnamespace and when i try to go on the sub-namespace, it transform the id from “projects:first_project” to “projectsfirst_project&1#chat“.
It delete the : between namespace and sub-namespace and it dont found the sub-namepace.
What I can do for fix this