krishna.p Posted June 17, 2009 Share Posted June 17, 2009 Hi Experts, Is there a way an admin user can send an alert message to all the users who are currently working on the application. for example, 2 users are working on my application. Now admin user logins into my application and enter some text like "This application will not be available for the next 2 hours. Sorry for the inconvience." in a textbox and clicks on SEND button. In this scenario, the 2 users who were currently logged in should get that alert as soon as admin user clicks on SEND button. Would appreciate if you guys can help me out in solving this problem. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
xcoderx Posted June 17, 2009 Share Posted June 17, 2009 that will for sure lang ur server if am not wrong. Quote Link to comment Share on other sites More sharing options...
krishna.p Posted June 17, 2009 Author Share Posted June 17, 2009 thanks for the reply xcoderx.. if i understand u correctly, it will cause heavy load on my server? Quote Link to comment Share on other sites More sharing options...
krishna.p Posted June 18, 2009 Author Share Posted June 18, 2009 any replies please.... Quote Link to comment Share on other sites More sharing options...
joel24 Posted June 18, 2009 Share Posted June 18, 2009 if i were doing it i'd have an error table in my database (+ there will now be an audit trail of errors/messages displayed) i'd have that table set up like id username dateTimeStart dateTimeEnd error usersViewed then i'd have a javascript function which posted to a php page every five minutes using the setTimeout("checkErrors()",30000); and if that page returned anything it would make a div pop up and display the error message... then the php page would using mysql and the user's ID and check if there are any errors where currentdateTime > startDateTime and less than dateTimeEnd then i'd have all the userID's of people who had seen the error message in the usersViewed seperated by commas i'd pull that and use PHP to explode(",", $errorDetails['users']) so that they were in an array then i'd use the in_array function to see if the user had viewed the error if not, i'd make the php echo the error message and the javascript function checkErrors would register this and popup teh error div and display the error message... the php function would also have to add the usersID to the usersViewed column. make sense? Quote Link to comment Share on other sites More sharing options...
krishna.p Posted June 18, 2009 Author Share Posted June 18, 2009 if i were doing it i'd have an error table in my database (+ there will now be an audit trail of errors/messages displayed) i'd have that table set up like id username dateTimeStart dateTimeEnd error usersViewed then i'd have a javascript function which posted to a php page every five minutes using the setTimeout("checkErrors()",30000); and if that page returned anything it would make a div pop up and display the error message... then the php page would using mysql and the user's ID and check if there are any errors where currentdateTime > startDateTime and less than dateTimeEnd then i'd have all the userID's of people who had seen the error message in the usersViewed seperated by commas i'd pull that and use PHP to explode(",", $errorDetails['users']) so that they were in an array then i'd use the in_array function to see if the user had viewed the error if not, i'd make the php echo the error message and the javascript function checkErrors would register this and popup teh error div and display the error message... the php function would also have to add the usersID to the usersViewed column. make sense? yes , Thanks for the reply.. now i got some idea.. Also will it have any performance issues? i.e.. i will have around 200 users working on my application. then if use javascript interval function for every 5 minutes to check the error, then i will get around 1000 requests at the end of 5 minute right? heavy load on server? Quote Link to comment Share on other sites More sharing options...
joel24 Posted June 18, 2009 Share Posted June 18, 2009 1000 requests? you'd get 200 requests every 5 minutes, you could set it to ten. and these requests would only happen if 200 users were logged in, in which case each page they view would most likely require SQL queries anyway. so if only 30 users are logged in, you'll have 30 requests every 5 minutes Quote Link to comment Share on other sites More sharing options...
krishna.p Posted June 18, 2009 Author Share Posted June 18, 2009 1000 requests? you'd get 200 requests every 5 minutes, you could set it to ten. and these requests would only happen if 200 users were logged in, in which case each page they view would most likely require SQL queries anyway. so if only 30 users are logged in, you'll have 30 requests every 5 minutes yes sorry its 200 requests.. if i set it to 10 mins in the worst case the users will be seeing the alert message after 10 minutes. i think this interval should be as minimum as possible..However i will give it a try..Thanks once again.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.