How to make a Chat Room for Your Website Using a Server Side Language

Jul 31, 2012, by admin

Here you will get instructions on how to make and run a chat engine on your website, using a server-side programming language. This article assumes you have substantial technological knowledge.

chat-roomsSteps to make a Chat Room for Your Website Using a Server Side Language

1.Install a server-side language such as PHP or ASP if you need to.

2.Create a database table with fields to store a nickname, time and message.

3.Create a user interface with 2 text boxes – one for entering a chat message and other for displaying the chat log.

4.Create the client-side script using Javascript and AJAX techniques. The script should do the following things:

  •  Use AJAX to transfer chat messages one wishes to send to the server.
  •  occasionally check the server for new messages and add them to the chat window. It needs to send the time of the last message received.
  • 5.Create the server-side script. It should do as follows:
  •     Add incoming messages to the database table with the nickname of the person that said it and the time stamp.
  •     Return new messages it has received after the time specified in the aforementioned AJAX request.