Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Inspiration and help needed

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi all,
Am after some help with a chat application I am building. Basically I am having real problems with showing a list of all the users currently logged in. Currently I have a bean for each user that is then also added to an application session bean which shows all the users, I have run into big problems though trying to remove a user from this application session bean should a user just close their browser so I think I'm going back to the drawing board.
What is the best way for coding this ? I was thinking maybe, use a servlet to 'log' a user in, create a bean for them and then add that bean to a bean containing a list of all the users, I could then use the session listener to keep check of when a user disconnects and the remove that user from the list of logged on users ? Would the bean containing the list of users be available for all the users to see ?
I'm sure this must of been done before and I've searched and searched but I'm really looking for a definitive guide as to how I should approach this whole thing before I jump in and start trying to code it all again.
Any ideas or input very gratefully received.
Jon
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Are you using an HTML based client? You really need a client with state.
I wrote a Flash based client that communicates with a Java chat server.
The server keeps up with who's connected by sending out pings to the clients. If the client doesn't pong back, it's dropped.
I'm sure you could write a Java client that does the same thing.
An HTML based client won't be able to do this, without some horrible refresh hack.
 
Jon Kidd
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Not sure how that would react to clients behind firewalls though ?
I've sort of now kludged something together using Applets on the browser and then calling the destroy method which in turn calls a servlet on the server removing the client from the list of logged on users. Difficult work though then trying to design a site around an applet that mustn't be closed
I'm sure there are easier ways but I have yet to see a simple and concise explanation.
Cheers
Jon
 
Dave Comeau
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Yeah, I don't think the client side destroy can be depended on. What happpens when the client's machine crashes or is unplugged?
As for firewalls, those ports are firewalled for a reason. So if the chat clients doesn't work, the sysadmin doesn't want people chatting. I know AIM steps around this and uses port 80, which pisses most sysadmins off.
 
Jon Kidd
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator


As for firewalls, those ports are firewalled for a reason. So if the chat clients doesn't work, the sysadmin doesn't want people chatting.


So an uptapped market then
Cheers
Jon
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
HI Jon,

I am creating a web application using JSP and Servlets which enables users to chat using JMS. I need to know how to know the solution to the following situation:


user1 and user2 are chatting with each other.
when user1 sends a message to user2 I use JMSQueue to insert the message at the server end.
But user2 retrieves the message from the queue only when I manually refresh the page or set the page to an autorefresh using a timer.

Please suggest how to overcome this drawback ie. how can I retrieve the message at the client end which is user2 only when the user1 submits the message ?
 
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
"ones ones", please check your private messages for an important administrative matter.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
And yo may want to consider starting a new thread, as this one is from 2003.
 
Arindam Bose
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Thanks for the suggestion David......
 
    Bookmark Topic Watch Topic
  • New Topic