Forum OpenACS Q&A: Chat module 3.2.5, defining cache size, javascript version

Hello

This is a question about ways to improve the chat module in OpenAcs
3.2.5. We know there has not been much development in this area
because IM clients like Jabber are recommended, but in many cases
people cannot use them (e.g. because of firewalls or other
restrictions.) A simple and reliable, user friendly chat module is
what we need. We have experienced that for most users the JavaScript
version works best. Still we want to improve some features, like
userfriendliness and speed.

We want to use Aolserver's cache to serve content, and we want to
serve as little information as possible, in order to reduce network
traffic.

The questions are:

1. How to define the cache size?

In [pageroot]/tcl/ad-utilities.tcl.preload the following lines exist:

# Pre-declare the cache arrays used in
util_memoize.                    nsv_set util_memoize_cache_value .
""                                  nsv_set
util_memoize_cache_timestamp . ""

What kind of value should we use? Is this in bytes?

In:

proc_doc util_memoize {tcl_statement
{oldest_acceptable_value_in_seconds "60"}}

we use as you can see 60 seconds, because it is just chat 😊

2. The next thing is the layout and behavior of the javascript window.
We want the space for text to be bigger, and we want to define the
"enter" key as the way to insert a message. (No need to use a mouse
when chatting, or optional. Most users use tab-enter at the moment,
but this is tedious.) How can this be done in JavaScript (shouldn't be
too difficult eh?).

3. A next thing could be a way to reduce the number of messages in the
javascript window, i.e. only the last 5 or 10 messages should be
served. This reduces network load. (Users can always read all messages
in "history".

Thanks for your suggestions, it would be nice if someone with
knowledge of javascript could help us because we cannot do that
ourselves.

Hans and Ben (www.klessebes.nl)

4. After "enter" the message should be sent (see above) and, even more importantly, the space cleaned, ready for a user to type in a new message.
This doesn't address any of your questions, but I just wanted to point out an OpenACS site which effectively integrates IRC to provide a chat solution:
    www.carnageblender.com

Jonathan: If you haven't already, could you describe what was involved with that?  Also, are there any issues/problems/bugs with the solution?

The rest of you beware.  The site is highly addictive!

It's pretty simple...  I hacked an irc server to allow longer user names (nicks) and not require a successful RDNS lookup (my work's firewall screws those up; other people are probably in the same situation) and hacked my client applet for the same.  Then, because my home dsl connection that my server is based on is kinda sucky, I added auto-reconnect to the client.

For those who haven't been to the site -- I wanted a chat window taking up the bottom 10th of the screen so players can talk with each other without needing a separate window.  I tried setting this up w/o javascript by having user-new-2.tcl, user-login-2.tcl, and the cookie handler in index.tcl source the frameset page depending on the http-referer, but it would sometimes get confused and the user would end up with 2 chat frames.  So now the main page has javascript to redirect to the frameset page as needed and that seems to work better.

Since this is IRC you don't get any IM capability like you do with jabber, nor is there any authentication.  No logging, either, although this would be trivial to add either directly to the server or as a special client.  But IMO it's a vast improvement over the historical ACS "chat."

I've put my code at http://www.carnageblender.com/public/irc/ for those who are interested.