Jump to content

Can i send global alert message to all users using RPC?


krishna.p

Recommended Posts

Hi all,

Requirement: When admin user enter some text and clicks on send button in one particular screen of my application, the message should be sent to all the users who are using my application. 

        I would like to send global alert message to all users..in my previous post on the same topic i got some ideas from you and had implemented it.. but it has some performance issues... i.e...it is clearly evident that my server is receiving heavy load...

        Actually my application is running in FreeBSD box. Here is there any way i can fix this issue using RPC..i.e...Remote procedure call.. ultimately all users should notice the message sent by admin user.

        Any help would be appreciated.. Thanks in advance...

I'd say add a column to the user table, call it something like global_admin_msg_read, set it to bool, and create a small table called `global_messages`, and add 2 columns: `id` and `msg_body`.  When you post a message, you post the message to the new table, and run a query something like this

UPDATE `users` SET `global_admin_msg_read`= 0;

then use an ajax script on the frontend to check every so often for unread messages. when it show that there is an unread message, have it grab the message, and set the global_admin_msg_read to 1.

 

to have it check, use a query like this

SELECT * FROM `global_messages` ORDER BY `id` DESC LIMIT 1;

oh, and make sure ID is auto increment.

 

I'd post some real code, but I'm a firm believer in posting code only after the person asking the question has.

Hi All,

I think i am 50 percent successful in solving this problem. I have installed samba client in my FreeBSD machine. Through console when i type message "cat message.txt | smbclient -M MACHINENAME", the message present in message.txt file is successfully sent to MACHINENAME.

      However when i am trying to execute the same command through php script as exec("cat message.txt | smbclient -M MACHINENAME"); the message is NOT sent. Is there any thing iam missing. Would appreciate if you could please explain how to execute above command through PHP? Thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.