Link to home
Start Free TrialLog in
Avatar of dgrafx
dgrafxFlag for United States of America

asked on

Push a notification to other website visitors triggered by an event

I'm looking for the simplest way to do the following:

Users are on a website doing their thing then when one of them submits a form via Ajax and when the Ajax call is complete then "push" a "notification" to all other visitors that are currently on the site.


Thanks

Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Hey there,

What I think you're looking for is WebSockets. Basically, you would need to configure a server and a client. A good example is the Pusher service (https://pusher.com/). There's also Socket.IO (https://socket.io)

You would create a Channel on the  Server, and then configure your website to listen to that Channel

When a User makes an AJAX request, you would 'push' your message to the server, and the 'listener' would see that and receive a notification. You then code your site to handle that notification (update the HTML / alert a message etc).

That's a very, very basic overview of the process. Exactly how you implement this will depending on your own development stack. For example, if you're using Laravel, look into Broadcasting.
Avatar of dgrafx

ASKER

OH NO!! I should have stated that I can't use websockets because of a limitation on my shared host ...

What other ideas do you have?

I appreciate it!

BTW - is it possible to use socket.io without installing anything on my host?

Hi,


Which serverside code are you using, PHP, ASP ?

Avatar of dgrafx

ASKER

There isn't a server language on the front end - just Javascript. There is database connectivity on the backend using CF that is communicated with via Ajax.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK,

If you're using ColdFusion, then you'd need a different server-side wrapper. Here's a link to a ColdFusion one, but I know nothing about it.

The client-side JS would stay the same

Avatar of dgrafx

ASKER

Thanks Chris! I will experiment later today!

Can you post that CF link that you mentioned please.
Avatar of dgrafx

ASKER

Thanks Chris! I'll post after testing ...