0

This isn't platform / or language specific really, I'm just asking for some general advice on how to approach what I want to do and what would be the best technologies to utilize.

I want to implement something similar to the way Periscope displays it's likes. Check this CSS / jQuery rework if you're not sure what I mean.

The Set Up :

Basic social network site, built with PHP, where every user has a profile.

What Happens :

User Foo triggers an event on the profile page of user Bar (specific to Bar's page), let's say a "like" for example.

The Goal :

I want that event to trigger a jQuery animation, simple enough to do, and User Foo will certainly see it. But what I want to do is make that event trigger on User Bar's profile page, in real-time for whoever happens to be looking at Bar's profile at the time. So the event Foo triggered will render globally in every other users browser - but only if they are looking at User Bar's profile when it is triggered.

I know this could be achieved with a constant stream of timed Ajax requests looking for any events, but is there a better less resource intensive way of approaching this?

I've recently started playing around with Vue.js and Laravel, and it seems like the broadcast channels could possibly be used for this purpose, but is there anything similar in jQuery that could be used.

Or would you suggest that the jQuery / Ajax approach is the best way to go?

It doesn't have to be jQuery or Vue based, any suggestions welcome if you think there is a better way of doing it, as this is really what I'm asking for, but would rather build this from the ground up and not use a plug-in.

spice
  • 1,442
  • 19
  • 35

1 Answers1

0

Real-time updates are discussed here: How do real time updates work?

I didn't have the heart to close as duplicate after such an eloquent and well written question :)

Alex Paven
  • 5,539
  • 2
  • 21
  • 35
  • haha I appreciate that! So it seems that websockets is the way to go then. Thank you for pointing me in the right direction! – spice Jan 04 '18 at 18:04