I have a school project in which I have to implement a chat application, whose server will be a java web service.
The problem is that I've always thought of a web service as a way of calling remote functions, and I have no idea how to keep a "session" active on the web service, nor how to keep track of all the people currently in chat, rooms etc.
A chat service is any online service or technology that enables text messages to be translated in real time between participants. Often used in customer service as “live chat,” chat services connect a customer service agent with a customer for a real-time, instantaneous conversation.
Messages that are entered in the Chat window are sent to the destination via the chat server. In a chat environment, therefore, the personal computer that runs the chat server can be considered the server and a personal computer that is connected to the chat server can be considered a client.
A chat application makes it easy to communicate with people anywhere in the world by sending and receiving messages in real time. With a real-time chat app, users are able to receive the same engaging and lively interactions through custom messaging features, just as they would in person.
To the best of my knowledge, a chat server is supposed to know its clients after an initial connection, and send every client message to all clients. This definitely calls for some sort of session maintenance. I think the right way to do this is as follows:
I'm not really sure how the message distribution should work, as web services are essentially a pull-service and not push. Perhaps the client should expose its own web service for the server to call.
Hope this helps,
Yuval =8-)
You could consider implementing a COMET solution. This will effectively give you push communication, thus eliminating latency, a VERY nice feature for a chat application.
If you want to go for the gold, consider implementing more advanced features:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With