From c43f3b6651b92743f42ef77db35b2d0b1807d902 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 3 Nov 2016 11:07:13 +0100 Subject: [PATCH] interface trigger actions --- src/Api/InterfaceControllerProvider.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Api/InterfaceControllerProvider.php b/src/Api/InterfaceControllerProvider.php index abea2ea..69f8d01 100644 --- a/src/Api/InterfaceControllerProvider.php +++ b/src/Api/InterfaceControllerProvider.php @@ -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; }