one-way instant message

I am interested in having our intranet site incorporate a one-way messaging feature for supervisors to relay information back to employees. Preferably in CF, the supervisor would login to the admin section from which he can send off a broadcast message that would show up on each computer (intranet is on active desktop).

I'm just not sure where to start with this, any ideas and or links would be helpful.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Seth_BienekConnect With a Mentor Commented:
Hey urbanc,

If each computer was assigned a static IP address then you would have a table in your database with basically 2 columns (probably more, but for demonstrative purposes let's stick to the main 2 columns): IP_ADDRESS and USERNAME.

First you would have to enter the IP address and corresponding user's name into the table for every computer using the system.  If you wanted to automate this, and trust the users to enter the right name, you could create a web form for this.

Next, you would create a session or client variable for the user whenever they visit the site, to remember their name.  Something like this in your application.cfm:
<cfparam name="client.username" default="">
<cfif not len(trim(client.username))>
  <cfquery name="lookup"... >
    SELECT username FROM users WHERE ip_address = '#cgi.remote_addr#'
  <cfset client.username = lookup.username>

Then, based on the value of client.username,  you would know who's at the other end of this page request.

As far as keeping track of who's seen what messages, you would need two more tables.  One to contain the messages themselves - let's say a table called MESSAGES, with columns MESSAGE_ID and MESSAGE_TEXT (again, just two columns for demonstrative purposes), and another table called MESSAGES_QUEUE, with columns MESSAGE_ID, IP_ADDRESS, and DELIVERED.

Whenever a message is generated, you would SELECT all the rows from USERS (for broadcast delivery) or just the ip_address for specified users for 'addressed' messages, and insert a row for each user into the MESSAGES_QUEUE with the new message_id and ip_address for each user, and set the delivered column to have a value of '0' for 'not delivered'.

Then to check for messages a user has not yet seen you would join those two tables, and you would want to mark the messages_queued.delivered column as '-1' (ot true) when a message for a given user has been viewed.

I'm trying to sum up a decently complex app in a small space here, so there may be some vague spots, but I think I've covered the general framework.


What IM platform are you wanting to connect with?  AIM, ICQ, MSN, Yahoo, SameTime?

It's doable but you will need information about the messaging protocol you intend to use.


urbancAuthor Commented:
Well I wasn't wanting to use msn messenger or aim or anything like that. just have it all embedded on the actual page. without using a seperate program like msn, yahoo, aim.

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

So it sounds like what you are wanting to do is allow supervisors to insert some text into a database, and then have the desktop clients poll the database for available messages.

Unless you have active the desktop refreshing itself or an element (ie a hidden div or iframe) using javascript, there's not really a way for the polling to happen automatically.

Then, unless you're having the users login to the intranet site, or your network is set up with static IP addresses, you won't be able to tell who has received the message and who has not.

That's not to say it isn't doable - the main question I'm prompting you to ask yourself is, is this the most practical approach to solve the problem?  Without knowing too much about your needs for this project, it seems like what you are describing is a good application for plain old e-mail.


urbancAuthor Commented:
True, it might not be the most practical method, but we also don't have the capacity to provide so many emails and probably the main reason for not providing emails to all employees is because it will become another distraction from their actual work.

I just thought this might be an efficient way to provide information (ie. updating the status of a current project) to employees on a regular basis, in a way that is least distracting and is easy for all employees to view.

urbancAuthor Commented:
Seth, if each computer was assigned static addresses, how would you be able to verify which computer has received a msg? and if that is possible, would it not be possible to send a msg to specific computers via assigned ip addresses?

pinaldaveConnect With a Mentor Commented:
Hi urbanc,

as seth said before you need to know about socket to connect to them using the TCP/IP as this is the way to know where you sent msg and if they have received or not. Your idea of instant msg is great but that is instant msgr is not it? what you want is that if they have something to tell they can send instant msg one way through coldfusion applciation.
now you will have to create some application of the coldfusion which runs beyond your browser and inform the user when he receives the msg.
OR what we need is that we need to create such a system, when there is mesg on your perticular TCP/IP protocol it opens up the browser and informs the user that this is the news.
OR what we need is that when the msg is received it will show up on your users existing page that the msg is for him.

Well all this options has lot to discuss and may be /may be not that possible. Well, I love CF but I do not see CF doing IM job as this is web based application and does my life easy with its simplicity with database. Also, when we receive the msg on TCP/IP network on some specific port and open the browser sounds like some kind of web service. Also you may need to create the client to  listen the network port continuolsy and when ever it receives the msg it has to launch its specific web application( or browser) to display the msg.

========================= My suggestion
This is what we are doing with our system, we have CMS and whenever supervisor writes something for any perticular person only he can see the comments and discuss using discussion thread. Other does not have any access. Also we have kept that web page auto refreshing and fixed size of the browser so it is like a bar at the bottom of the screen.  We launch in the mornig and keep it on the top (manually) and if there is anything new it will show as it refreshes every min, and will display the msg and we do two way discussion like msg board there. It is fun.
========================== END

Good explaination Seth here and also in my Q. Thanks! :-)
russmichaelsConnect With a Mentor Commented:
Simply have a webpage where a user logs in and then displays any new messages for that user.
The page will regularly refresh itself and check the database for new messages for that user.
If a message does exist you can use javascript to focus() the browser window so it pops up or comes to the front.
If your using active desktop then you can place a small window on users desktops that will act as a webpage.

Your sysadmin then has a simple interface where he can select a user and send them a message which will then popup on their desktop.

you do realise that windows network already have the facility to send messages to other users on a network, it's called the messenger service.

To use it, simply open a command prompt and type

net /?

this will give you help on the net command

using "net send" will allow you to send messages to other machines


net send MACHINENAME "message"
will popup a windows alert on that persons machine.

For what your asking, this seems like a simpler solution.


Russ Michaels
I think, I should also have points here for good suggestion along with other two experts.
Well it's for others to decide if your suggestion was good or not, not you. Personally I don't think it was any good. But you got points for your moaning anyway, so be happy.
Personally I agree with russmichales.

Just because you comment does not mean your comments deserve points.

You often complain that you should get points just because you made a comment, but really the points should go to the comments that are the BEST and MOST COMPLETE answers for the question - not to everyone who participates.

I carefully read each comment when making a recommendation and sometimes select your comment as the answer and sometimes select other comments.  But you almost always post a complaint if your comment is not selected - even if it really wasn't the best answer or even if it didn't answer the question at all. In this post you even start out as saying "as seth said..." which further indicates that Seth's answer is probably a better one to select.

Before complaining that you should get points it would be nice if you also carefully read all of the responses and considered them objectively.
Thank you all,
I will say, We are using the system which I have suggested and I strongly believe in what I said.
I will rather avoid arguments here about what is correct or not. I strongly believe that everybody has right to say what they want to say.
Your opinion is valuable. When I say some body is good does not mean that I am bad. Praising someone else is good thing, if they are better.
Again, I only post comment when I think, I am correct. I will never worry/argu if other are not incorrect. I do not believe in that.
All Courses

From novice to tech pro — start learning today.