interface trigger actions

This commit is contained in:
Ruben 2016-11-03 11:07:13 +01:00
parent 9fc3de9bd3
commit c43f3b6651
1 changed files with 19 additions and 2 deletions

View File

@ -114,10 +114,9 @@ class InterfaceControllerProvider implements ControllerProviderInterface
return $app['serializer']->serialize($output, 'json');
});
// /interface/images
$controllers->get('/images', function (Application $app) {
$http_origin = $_SERVER['HTTP_ORIGIN'];
if ($http_origin == "https://emotionhero.com" || $http_origin == "http://emotionhero.com")
{
@ -165,6 +164,24 @@ class InterfaceControllerProvider implements ControllerProviderInterface
return $app['serializer']->serialize($output, 'json');
});
// /interface/images
$controllers->get('/trigger/game', function (Application $app) {
// trigger update of client:
try{
Websockets::triggerUpdate('game');
}catch(\Throwable $e) {
// nothing
}
});
// /interface/images
$controllers->get('/trigger/images', function (Application $app) {
// trigger update of client:
try{
Websockets::triggerUpdate('images');
}catch(\Throwable $e) {
// nothing
}
});
return $controllers;
}