|
-
May 21st, 2010, 07:40 AM
#1
best practice to check local mail
Hi
i have built a small mechanism for users to send and receive mail inside my website. this mail system not involving smtp, it's only messages that are saved in the site DB.
right now the only way i can see for checking if a user has new mail is to check the db in every page the user is visiting during his stay in the site which seems to be a bit cumbrous, is there any better approach of doing such thing ?
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
May 21st, 2010, 11:07 AM
#2
Frenzied Member
Re: best practice to check local mail
hey,
why you add the e-mails into database ?
i think you can add the emails into folder with the name of the account, something like the svn if there is any change into this folder it will get the new emails for the users, and so on
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
May 21st, 2010, 12:06 PM
#3
Re: best practice to check local mail
avrail - think PMs.... like on this site here... when you send a PM to some one, it gets stored in the database... It's not an actual email of any kind.
-tg
-
May 21st, 2010, 12:11 PM
#4
Frenzied Member
Re: best practice to check local mail
 Originally Posted by techgnome
avrail - think PMs.... like on this site here... when you send a PM to some one, it gets stored in the database... It's not an actual email of any kind.
-tg
amm, put i think if i didn't notice that there is a pm i will never open it.
but may be this can help,
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
May 21st, 2010, 12:13 PM
#5
Frenzied Member
Re: best practice to check local mail
hey,
motil what's your database ?
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
May 21st, 2010, 08:02 PM
#6
Re: best practice to check local mail
What I did on a site for sales reps needing to be notified of schedualed tasks was put a little ajax on the master page that polled the database evey page load and then every minute. If a task was due then a notice was displayed. I wouldn't do that on a site like this (VBforums), page load or even login would serfice because of performance and minute by minute messaging would be overkill.
-
May 22nd, 2010, 04:12 AM
#7
Re: best practice to check local mail
@Avaril, i'm using MySql as my database
Hey brin what you're suggesting is actually the same thing just using ajax, you still need to query your db in each request, i thought about using ajax for this task but i abandoned that idea.
just for the record i don't think what you suggested is overkill, i used the same thing in my workplace website and its checking the DB for every 7 seconds, it's online for almost 2 years now and we never had problem with it. i never checked it but i believe that facebook doing the same for their chat application, servers now days are very strong and fast and as long you're careful there is no reason of why not to do it.
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
May 22nd, 2010, 04:22 AM
#8
Re: best practice to check local mail
Is there any chance of you moving to a silverlight application? There you would have the concept of subscribed to server events, to be notified if/when something happens.
Gary
-
May 22nd, 2010, 04:27 AM
#9
Re: best practice to check local mail
Hi Gary,
I never used sliverlight isn't like flash but for micrtosoft?
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
May 22nd, 2010, 04:43 AM
#10
Re: best practice to check local mail
Silverlight has some similar aspects to flash, but flash it is not.
You might want to take a look at it, and decide for yourself, a good place to start would be the sample applications here:
http://www.silverlight.net/content/s...n/default.html
You will likely need to install Silverlight to get it to work.
Gary
-
May 22nd, 2010, 05:56 AM
#11
Re: best practice to check local mail
Hey brin what you're suggesting is actually the same thing just using ajax, you still need to query your db in each request, i thought about using ajax for this task but i abandoned that idea.
just for the record i don't think what you suggested is overkill, i used the same thing in my workplace website and its checking the DB for every 7 seconds, it's online for almost 2 years now and we never had problem with it. i never checked it but i believe that facebook doing the same for their chat application, servers now days are very strong and fast and as long you're careful there is no reason of why not to do it.
If the messages are in a database but you don't want to query the database for new messages how is that going to work? Gary's suggestion of silverlight will work if both parties are online at the same time (I didn't know silverlight could do that I must get around to playing with it) but if not your going to have to query the database at some point. I'm a little confused at what your goal is, a sort of message system that can act like a chat system if both parties are on at the same time?
The reason I said ajax on timer to query database would be overkill here at the forum is there can be many hundreds of concurrent users all of which would be polling the database continually, that is alot of traffic and overhead. A more in house website with limited users is no problem. I'm sure facebook have dedicated chat server/s not bundle that service into the web app, having said that I don't use facebook so I'm taking a stab at what sort of chat service they have.
-
May 22nd, 2010, 06:16 AM
#12
Re: best practice to check local mail
I haven't read all of it, but it would seem like this covers a similar thing to what you are asking:
http://dotnetaddict.dotnetdevelopers...alarmclock.htm
Gary
-
May 22nd, 2010, 03:51 PM
#13
Re: best practice to check local mail
@brin351 - yea i know i must query the db if i want to get new messages i just decided to take a long shot and see if anyone here has some creative idea, Maybe loading this table into memory for faster access or i'll just bite the bullet and query this table in every page.
as for your question its just a simple mailing system, user a sending user b a message, once user b log in he sees "you got x new mail" or if he's already online he will see this message once he loading new page.
as for the ajax, if we'll take VBFORUMS as the example you are right by saying it got many hundreds of concurrent users, but the same rules apply for non-ajax requests and my guess is that most active users here will request new page in less then 1 minute or so, so if this server can handle that he can surly handle the 1 minute ajax timer. to add to that we need to take into consideration that normal http request are much more resource consuming then effective ajax call since the server send much more data while usually you'll use ajax to retrieve very small amount of data from the server (e.g. new e-mail count), I'm totally agree with you that as a developer you need to be very careful with any database request, but all and all if its a requirement there is no reason not to use ajax timer as long as you make it effective when needed.
@Gary - I don't think i'll dive into silverlight right now, already has three books to read + my own project + work but i must admit that it is looks interesting so i'll add that to my list.
and for the last link you posted, isn't done with WCF? can i use it in ASP.NET ?
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
May 23rd, 2010, 09:09 AM
#14
Re: best practice to check local mail
I have a very similar list to yours, I have lot's of stuff piling up that I want to play with.
WCF is used as the communication route to implement what I was suggesting, and Silverlight has a natural fit with WCF. You can use WCF with your ASP.Net Application as well, it is just that it isn't as natural a fit.
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|