Simple admin panel - how to refresh when data gets changed by another admin

Hello. I’m wanting to try Ember.js with a simple backend for users / admins / posts management.

I expect it to be very simple, but as soon as I’ve skimmed all the documentation, I still can’t understand the simplest thing - how should I update my Users table with changes made by another administrator from a different place?

The same question raises if a secondary admin gets removed - how to log him out immediately from the admin panel and stop his access?

So far it looks like complicating things instead of simplifying them. I feel that some bus (e.g. long polling) is needed, than special messages should be sent to clients when an entry gets added or removed from Users. I’m not sure if there are simpler approach - ?

Using PHP. Any help appreciated. – thank you

It sound like you want to use this instead.

You should take a look at Firebase or Pusher.

1 Like

Thank you for your advice, but I’m not looking for replacement of my technologies stack, but rather want to solve the issue with using existing stack.[quote=“rlivsey, post:3, topic:4040”] You should take a look at … [/quote]

Hm, I’d avoid using 3rd party services hosted outside of my server - too much things involved and doesn’t look smooth just to create a backend.

You would want some kind of connection between the server and the users.

You can either do it through socket connection.

Or you can use backburner.js (

If you want to handle it yourself, then or faye would be good places to start. They’ve node.js / ruby backends and not PHP of the box, although it looks like there are a number of PHP backends out there (eg faye-php-server for faye).

Hm, it looks like Faye is just a PHP library with interacts with the Faye server, which is, again, an additional thing to install on the server. I can see that there are solutions but it still doesn’t look simple and intuitive. If we compare to the simplest PHP + any Templating (e.g. Twig) + pure jQuery - to me it looks much faster to develop and mock up everything… but, again, if I weren’t interested in this - I wouldn’t ask ) So still looking for propositions and ideas.

If you’re wanting real-time updates in a single page app, then something like websockets is one solution - but as you’ve seen that comes with a fair bit of complexity. You’re having something happen on one client notify the server, which then needs to go out and notify all other connected clients.

There are a bunch of other simpler approaches you could take, such as polling the server to see if there have been changes etc… but all have their tradeoffs.

perhaps it’s not the answer you’re looking for, but we have a Grails backend and we’re working with Atmosphere which is a websocket framework for Groovy/Java and JavaScript/jQuery. with this library it’s really easy to setup a websocket connection – in my opinion, server polling should only be a fallback for clients which don’t support the websocket specification, as polling (and even long-polling) is just firing requests frequently when a websocket could be seen as a “real” bi-directional socket connection…

I also integrated a WebsocketManager util class which is able to notify any number of subscribers if something happend at the websocket connection, so that any class could listen to the same (or even x) websocket and all the setup and teardown as well as the send/receive actions are handled in one place.

for PHP, perhaps is something you could use?

1 Like

@herom do you have any example code available for your application that we might be able to take a look at? I’m a big Grails fan, and being able to make clean backends in Grails work well with Ember frontends is a major goal.

I expect it to be very simple, but as soon as I’ve skimmed all the documentation, I still can’t understand the simplest thing - how should I update my Users table with changes made by another administrator from a different place?

Anytime you do almost anything in Ember, whether its transitioning to a new Route, or even clicking on stuff, can trigger the Run Loop. This essentially refreshes the data bindings and updates your views. You can trigger the Run Loop yourself by using

Maybe try writing an event handler for whenever you see the user table change and trigger when it happens?

I’m curious how would you do this with just PHP, Twig and jQuery? You can pretty much translate the same approach to Ember.

Anyways If you don’t want to use a third party library that provides push notifications or create one yourself with you could go the simpler / less efficient route of creating some sort of “heartbeat” mechanism that checks the server every X amounts of seconds and trigger a specific action based on the response.

Where would you encapsulate the logic to long poll the server? Would you handle this within the Route?

1 Like