Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply 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

Simple Chat Program HTTP / Servlets

 
Ranch Hand
Posts: 100
Android Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am writing a simple chatting programming built over HTTP and allows people to chat with each other.

The way i am proposing to build the chat servlet, is that when a user logs into the servlet with a user name and password i return the user id of the person over the response object. I also put the user id of the person along with the response object into a global hashtable. When a person say user_id 1 wishes to chat with a person say user_id 2, i read the global hashtable and obtain the user id 2 response object. On the response object i send the message that user_id 1 wants to send to user_id 2.

Could anyone tell me if this method works, or would they be a better way of achieving the above task. I know off course HTTP is connectionless so how else can we send a response to a user who has not initiated a request.

Kind Regards

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic