main/build/api/module/message.php

37 lines
568 B
PHP

<?php
/**
* Created by PhpStorm.
* User: lucas
* Date: 07/12/17
* Time: 19:48
*/
namespace api\module;
use kwebsocket\core\wsinterop;
class message
{
public function POST_emergency($argv){
extract($argv);
$wsi = new wsinterop("localhost",9998);
$wsi->send([
"operation" => "PostMessage",
"message" => $message,
"username" => $username,
"location" => $location,
"channelType" => "Emergency",
"channelName" => is_null($URL_0) ? "" : "$URL_0"
]);
$wsi->close();
return ["sent" => true];
//TODO: tout poster dans la BDD
}
}