943,840 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 659
  • Java RSS
Jan 12th, 2009
0

Is it possible to create such a web based Instant Message System?

Expand Post »
Well, I know there are so many IM services. and that I want to build an IM system is just for practicing my programming skill.
Here there are several questions that come up to my head when starting to design it. As far as I know, we can only receive a response from the server by sending a request to it, but, for an Instant Message System, this is not realistic, by doing that, the Instant Message System is not instant. Let's assume that there is a server and several clients sending messages to it and receiving messages from it, how can I achieve that a client is able to receive a message from the server without sending a request on it's own initiative? this seems not realistic either.
Or I can set a timer using Javascript for a function to be executed from time to time to send asynchronous requests to the server and check if there are any new messages? but this seems not so efficient...

Any ideas?
Last edited by kevintse; Jan 12th, 2009 at 1:51 am.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
kevintse is offline Offline
38 posts
since Nov 2008
Jan 12th, 2009
0

Re: Is it possible to create such a web based Instant Message System?

Indeed, given that the underlying protocol used in almost all the cases, viz. TCP is connection oriented i.e. following the request/response model, you have to resort to some sort of callbacks or regular polling. Frankly speaking, asynchronous I/O, push pull technology etc. are pretty advanced concepts, not to be messed if you are just starting out. But anyways, to get started read this article which provides a sneak peek into Asynchronous messaging.

For creating standalone IM clients [not web based], look into the different protocols specifically aimed at IM, especially XMPP.
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jan 12th, 2009
0

Re: Is it possible to create such a web based Instant Message System?

If you want to see example of working chat system get copy of Java How to Program, 6th edition from Deitel and check out chap 24 at the end
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Jan 13th, 2009
0

Re: Is it possible to create such a web based Instant Message System?

I'm a bit perplexed... since this topic is in the Java forum I'm assuming that some Java programming is involved. As such, I'm imagining a Java Applet since we're speaking about something that's web based. Please correct me if I'm wrong, but if the server knows both users that belong to a conversation, then when one user sends a message (which would be a message to the server), then surely the server could just relay this message across using Sockets in Java. Both the server and the clients need to be listening for communication and everything else is abstracted from us isn't it?

I see that ~s.o.s~ pointed you to an AJAX article... hmmm well I suppose that is Java, but a limited subset. Isn't this more of a web development topic?
Last edited by PoovenM; Jan 13th, 2009 at 5:11 pm.
Reputation Points: 56
Solved Threads: 11
Junior Poster
PoovenM is offline Offline
147 posts
since Aug 2006
Jan 14th, 2009
0

Re: Is it possible to create such a web based Instant Message System?

> I see that ~s.o.s~ pointed you to an AJAX article.

It was because he mentioned Javascript hence a reference to the Ajax article was in order.
Quote ...
Or I can set a timer using Javascript for a function to be executed from time to time to send asynchronous requests to the server and check if there are any new messages? but this seems not so efficient...
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jan 14th, 2009
1

Re: Is it possible to create such a web based Instant Message System?

Oh I didn't mean that your post wasn't called for ~s.o.s~, I certainly respect a featured poster such as yourself. I actually skimmed the original post and didn't notice he mentioned JavaScript hehe. It was your reply that made me realize that it was JavaScript related.

I was just confused about why the post was here.
Reputation Points: 56
Solved Threads: 11
Junior Poster
PoovenM is offline Offline
147 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: James Bond Search Program
Next Thread in Java Forum Timeline: Sending Images from server to client





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC