![]() |
|
|
Published: Thursday, April 29, 1999 By Ryan S. First, what are the benifits of this? Here are some -
This is an outline on how to create any form of messaging clients for ASP. I don't go directly in the code, although I might go into it later. Heres how it looks. - Let's say you want to create a web site with features like, say AOL Instant Messenger (tm of America Online, Inc). You wan to be able to have a user list of who is online, be able to send messages, set away messages, etcetera. You will have a page load up in the main browser which is a logon page. This page gets username/password, and checks the validity in the database. If it is valid, then it loads a seperate window with an ASP page. This ASP page is set to refresh every 30 seconds. It will contact the SQL server, query to see if the people in the users list match the people marked online. This is done via two tables. The first table looks like this
The second looks like this:
That's it for those. While I recognize I don't fully discuss the table creation, I left it open for people who want to add/change fields such as phone number, email, etc.
Now that you understand the layout of the table, lets discuss the layout of the page. Here is a rough image (screen shots on the way!):
Explanation of letters: You could also include a banner ad if you wanted to do it for profit (if you do, talk to me, cause I want to help, cause i need $$$ =D) Now that you understand how that looks, you create a new window to send a message. It would be a frame set, looking like this: (screen shots on the way!)
The top frame contains a text box of who you are going to send a message to. This value will be pulled out using javascript when the submit button is pressed. Next, the middle frame has formatted text of all the messages, to and from the users w/ a scroll bar. Finally, the bottom frame has a multiline text box of the message you will be sending, and a submit button. When the user clicks the submit button, client side JavaScript will verify that neither the user name or message field is empty. If it is, cancels submitting. If not, it will fill the data values into the bottom frame to ensure that it is set. Then, it does the actual submit action. The submit action adds the message to the message database, marking the UserNames (perhaps utilize the UserName as the primary key, because you should not have multiple user names) of the sender and recipient, the date (now()) of the message, and the actual message (where all vbCrLf have been replaced w/ <br>). The messaging window center frame will update itself every 10 seconds. This could cause a high load on the server, so the option for the users to select the rate of update (which will then be stored in session variables and the database) could be changed (with a minimum # of seconds) Finally, the main window updates itself perhaps every 30 seconds. Each time it does so, it marks the latest update. Then, the ASP page would check if the latest update was greater than 5 minutes ago. If it is, it marks the user as away. Also, when the away button is pressed, the rate of change is changed from 30 seconds to 1 and 1/2 minutes. Then, if the user still doesn't update after 10 minutes (because he/she has closed the window) then they are marked as offline. This is all automated, and will be executed on the server's end. It would probably be a good idea to schedule the execution of runDLL32 executing a DLL subroutine which does these matinence features every 3 minutes. Keeps the clients from hitting the server really hard. Thus, I am done writing this tutorial. I only discussed theory, obviously. Theory is what is important, though. Syntax is merely semantics; understanding the ideas behind an application is what is important! Happy Programming!
This article was written by
Ryan S.
Ryan has been a computer programmer
in the loosest sense since the age of 8. He has been working with ASP
since the age of 13, when it first came out (that he knows of), and is
somewhat advanced at it.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||