0

My question is a little bit difficult, let me explain:

I have a webpage for 10-15 workers and I want to click a button on my PC (a simple html button or something like that), and then when you press it, it appears an alert or pop-up in the screen of all the people that is on the webpage.

It's that possible?? Thanks :)

  • can you create an JSON object or array on server side whenever your page got connected ?? – Shubham Dec 17 '15 at 12:02
  • A helpful stack answer, maybe... [Push notifications](http://stackoverflow.com/questions/9106516/push-notifications-from-server-to-user-with-php-javascript) – yjs Dec 17 '15 at 12:08

1 Answers1

0

This is kind of easy to do with websockets (socket.io).

You'd do something like this on the server side

socket.broadcast.emit('alert', 
{
    message: 'Alarm!'
});

And something like this on the client side:

socket.on('alert', function (data) 
{
    alert(data.message);
});

Using sockets is probably the easiest way to achieve this, but if you have not used them before it is going to take some time.

Swiffy
  • 4,401
  • 2
  • 23
  • 49