Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple Chat Program HTTP / Servlets  RSS feed

Robert Darling
Ranch Hand
Posts: 100
Android Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!