Java chat

Hi everybody.

I've got a client that wants to add a chat room(s) to their site.

They don't just want a chat client that points to an mIRC server or anything like that.

It's just supposed to be chat functionality for the visitor's to their site.

Now chat rooms are not my strong point.

My understanding is that if I want to have a live chat (where you don't have to keep hitting refresh), you need to use Java (or ActiveX, but that's not a possibility since it needs to be a cross browser solution).

Question1: Is this understanding correct?

Second, my understanding is that if I use Java on the client, I will also need a Java chat server running on the web server.

The problem here is that most commercial hosting services (that I have checked with) will not allow server software to be installed.

Question2: Do I in fact need a Java chat server or is there another solution?

Any and all help/component referrals/host service referrals/comments will be most appreciated.

Thanks a lot!
LVL 5
mayhewAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
helverConnect With a Mentor Commented:
A real time capability requires that you go outside the normal operation of http.  If your service provider is unwilling to allow even fully tested and stable server processes to run then it would seem that they are not providing you with the service that you require to meet your needs.

What RMI does is allows an applet to execute a function of a java server process.  It makes data transfer and the ugliness of networking kinda go away.
0
 
helverCommented:
In general, if you want data to appear on the client browser without having to issue a request you want an applet.  However there are other solutions, although they aren't pretty.

1) Obviously, an applet.

2) Some sort of server push mechanism to force page updates down to the client.

3) Client pull... a timer that after X number of seconds, you go get the latest view of the pages.

These options are the result of http being a request/response protocol.  Options two and three work around that fact by sending multiple requests and/or receiving multiple responses.

You might be able to get away with dropping a link in that links you to an IRC type chat room - <a href="telnet://x.y.com:2900"> Chat here</a> or something of that nature.

If you had to choose between the three options listed above, I think that option 1 is preferable.  You get a little extra overhead for startup because you have download the applet, but once the applet is on the client machine, all you have to transfer are the messages.  Options two and three force an entire page to be sent with each update.
0
 
mayhewAuthor Commented:
helver, thanks for the comment.

That was pretty much my understanding on the client side.

What about on the server side (using the applet solution)?

Do I need a chat server?  Or can I just use applets that tie into a database?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
helverCommented:
In order to minimize traffic back and forth to clients, you should probably write some minimalist server...  I would imagine that the server would be event driven and would act something like:

while (1) {

   wait for event;

   switch (event type) {
   case NewClient:
      Add Client to ClientList;
      break;
   case ClientLogout:
      Remove Client from ClientList;
      break;
   case NewMessage:
      Send text to all Clients in ClientList;
      break
   }
}

No polling.  No tight loops.  It also doesn't have to be written in Java.  As long as you agree on a protocol it could be written in C, perl, C++, python, etc.  Writing it java would allow you to use RMI, however, and THAT would make it REALLY easy.
0
 
mayhewAuthor Commented:
Help me out.

What is RMI and how would it make things easier?

Also, do you know of any freeware software that may already exist?

And again, if I write (or use) server side software, won't I have to have it installed on the web server (which most services don't want to do)?  Or can I just have it run in my cgi-bin directory?

Thanks for your help.
0
 
mayhewAuthor Commented:
Can anybody help with this?
0
 
dalehendCommented:
A client/server app would mean using the Server's JVM. If you
know of any free hosting servlet services, let me know ;P
I think your best solution would be to use an existing Chat server such as RajChat, they give the applet classes and html to install on your server:

0
 
dalehendCommented:
0
 
mayhewAuthor Commented:
Thanks for your comment dale.

But in order to install that software on my web server, I need administrative rights.

And my hosting service won't install it for me.

Maybe the question here is if I need to bite the bullet and change to a different service?
0
 
dalehendCommented:
No, my answer related to only installing the applet and html on your web service and that is all. the RajChat applet uses the existing RajChat Home server, i.e., java.KaushikRaj.com:8080, and not your own web server. Its a simple installation.
0
 
mayhewAuthor Commented:
dale,

As I suggested in my original statement, I can't have my clients going to a "shared" chat server.

It has to be available to my client's audience only.

"It's just supposed to be chat functionality for the visitor's to their site. "

Perhaps I didn't say it very well, but the intent was to have a service that only visitors to their site could access.

I have awarded the points to helver, but I realize that you may have misunderstood the question.  Therefore, if you have a solution that will help me, I will create another question for you.

But linking to someone else's chat server or installing chat server software will not answer my question.

Otherwise thanks for your comment.  I appreciate your effort.
0
 
mayhewAuthor Commented:
helver,

That is pretty much what I've decided.  I'm going to begin researcing a new service.

Can you point me in the right direction to begin studying RMI?  Books or sites?
0
All Courses

From novice to tech pro — start learning today.