break; case 'nest': //Save JSON $arr = array("nest" => array(), "hamburger" => "tasty"); array_push($arr["nest"], array("chicken" => "white", "beef" => "red")); saveJSON("nest", $arr); echo var_dump($arr); break; case 'msg': //Save JSON postAppMessage('io.overplay.mainframe', 'io.overplay.test', array("msg" => 'payload')); echo 'ok'; break; case 'msg2': //Save JSON postAppMessage('io.overplay.mainframe', 'io.overplay.testa', array("msg" => 'payload')); echo 'ok'; break; case 'poptest': $msg = popAppMessage('io.overplay.testa'); echo json_encode($msg); break; case 'null': $ar = array(); array_push($ar, null); array_push($ar, "alpha"); array_push($ar, null); array_push($ar, "beta"); jsonOut(json_encode($ar)); } } else {
function signalLayoutChange() { postAppMessage('io.overplay.overplayos', 'io.overplay.mainframe.tv', array("layout" => true)); }
* */ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); require '../shared/shared.php'; require '../shared/messaging.php'; /* MAIN ENTRY */ $entityBody = file_get_contents('php://input'); if (isPOST() || isPUT()) { //TODO reject if the format is wrong (no dest, etc.)cd $msg = json_decode($entityBody, true); $dest = $msg['dest']; $src = $msg['src']; $data = $msg['messageData']; postAppMessage($src, $dest, $data); echo $entityBody; } elseif (isDELETE()) { if (isset($_REQUEST['appid'])) { badReq('Delete not supported, dude.'); } else { badReq('missing appid'); } } else { if (isset($_REQUEST['appid'])) { $msg = popAppMessages($_REQUEST['appid']); echo json_encode($msg); } else { badReq('missing appid'); } }