upd: api.message (UPT message/emergency)
This commit is contained in:
parent
741656e6f1
commit
044abf22e4
|
@ -119,20 +119,35 @@ class message
|
|||
public function PUT_emergency($argv){
|
||||
extract($argv);
|
||||
|
||||
/* (1) Create emergenct
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Try to create entry */
|
||||
$updated = Repo::request('emergency', 'update', $id, $message);
|
||||
|
||||
/* (2) If cannot create -> dispatch error */
|
||||
if( $updated === false )
|
||||
return ['error' => new Error(Err::RepoError)];
|
||||
|
||||
|
||||
|
||||
/* (2) Send to WebSocket
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Create socket */
|
||||
$wsi = new wsinterop("localhost",9998);
|
||||
|
||||
/* (2) Send data */
|
||||
$wsi->send([
|
||||
"operation" => "UpdMessage",
|
||||
"id" => $id,
|
||||
"message" => $message,
|
||||
"operation" => "UpdMessage",
|
||||
"id" => "$id",
|
||||
"message" => $message,
|
||||
"channelType" => "Emergency",
|
||||
"channelName" => is_null($URL_0) ? "" : "$URL_0"
|
||||
"channelName" => "$URL_0"
|
||||
]);
|
||||
|
||||
/* (3) Close socket */
|
||||
$wsi->close();
|
||||
|
||||
return ["sent" => true];
|
||||
//TODO: tout poster dans la BDD
|
||||
return ['updated' => true];
|
||||
}
|
||||
|
||||
public function POST_event($argv){
|
||||
|
|
Loading…
Reference in New Issue