Files
Testing/videocall3/RTCMultiConnection/demos/SSEConnection/SSE.php
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

29 lines
782 B
PHP

<?php
// Muaz Khan - www.MuazKhan.com
// MIT License - https://www.webrtc-experiment.com/licence/
// Documentation - https://github.com/muaz-khan/RTCMultiConnection
require('write-json.php');
require('get-param.php');
require('enableCORS.php');
// date_default_timezone_set("America/New_York");
header("Content-Type: text/event-stream\n\n");
// "me" stands for "Current User Unique ID"
$me = getParam('me');
$json = file_get_contents('./rooms/' . $me . '.json');
$json = json_decode($json, true);
echo 'data: ' . json_encode($json) . "\n\n";
foreach ($json as $receiver => $val) {
// skip duplicate entries for future requests
// todo: find a better solution to clear only entries; NOT the entire JSON.
removeJSON($me, $receiver);
}
ob_flush();
flush();
?>