Click here to Skip to main content
15,887,979 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi I am developing .NET Web-forms based application in c#. I need to add a module in the application which allows chatting between logged in users and users can share files during chatting, like Skype. Meanwhile I have to keep a PERMANENT RECORD of each and every word of conversation and files transferred during the session, on my server. I have a bit idea about the implementation of module to achieve the desired result, but I am sure that is not a good practice. Here is my idea:

Chatting: While users are chatting, create a data-table which will contain the sender id, receiver id, and message contents. When ever user presses send button or hit Enter, a new row would be inserted in the data-table with both IDs and message contents and then the data-table will be bound to a div etc. to show updated messages to both users. At the end, on an event (like window close etc) data-table will be converted to the XML and the XML file will be stored permanently either on hard disk or in database.

File-transfer: During chatting whenever user press enter/send button we will check the message contents, if the message being sent is a file (with some extension) then upload the file on server and provide a download link to the receiver.

I hope you got my point.

Problem:

1) I want to share files asynchronously i.e. transfer to the receiver and save on the server at the same time. Is it possible?

2) How to tell one user that the other user is typing?

Is there any better way to implement this module? What sort of knowledge should I have to properly comprehend and implement the module?

Thanks for any guidance.
Posted
Comments
Swayam231 30-May-13 13:17pm    
have u just thought or written some codes also..?? If yes then post it

1 solution

The only problem is that the whole Web (that is, HTTP) is based on pure client-server model, which is very, very limiting. Being just fine in many other cases, it presents the number of problems for Web chats, specifically. You mentioned just two of them.

For some background, please see:
http://en.wikipedia.org/wiki/Client-server_model[^],
http://en.wikipedia.org/wiki/Pull_technology[^],
http://en.wikipedia.org/wiki/Server_push[^].

As the server push explained in the article referenced above is not supported generally, you cannot immediately push any piece of data to the client. Everything happens on the HTTP request from the client. That said, if the client has to get the notifications as they appear (in your case, this is the notification like "File [filename] is delivered by [member]" or "[member] is typing..."), this client should send an HTTP request periodically, to get some notification information. It can be done in JavaScript timer handler and Ajax, or the whole page could be periodically reloaded (such chats exist, but this is a very sloppy way).

For further detail, see, for example, this tutorial: http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=9[^].

You will be able to find a lot of available projects or articles:
http://bit.ly/16t6Xj6[^],
http://www.codeproject.com/search.aspx?doctypeid=1&q=ASP.NET+chat[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900