diff options
author | Joachim Bauch <bauch@struktur.de> | 2018-05-09 15:24:11 +0300 |
---|---|---|
committer | Joachim Bauch <bauch@struktur.de> | 2018-06-12 13:05:27 +0300 |
commit | a5b899c8ba1532fa9fa0a8ee478ce685ce658a5e (patch) | |
tree | 98787b2c0e8b7512bba4137e8977f3a243dffa54 /lib/Signaling/BackendNotifier.php | |
parent | 2d1663956935d46d08c01c56beaf58ef814693a6 (diff) |
Use standalone signaling server to notify about new chat messages.
This removes the long-polling against the PHP backend and instead sends an
event to all users in a room through the standalone signaling server to
notify that new chat messages exist.
Signed-off-by: Joachim Bauch <bauch@struktur.de>
Diffstat (limited to 'lib/Signaling/BackendNotifier.php')
-rw-r--r-- | lib/Signaling/BackendNotifier.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php index df2e7949a..b185aecec 100644 --- a/lib/Signaling/BackendNotifier.php +++ b/lib/Signaling/BackendNotifier.php @@ -316,4 +316,20 @@ class BackendNotifier{ ]); } + /** + * Send a message to all sessions currently joined in a room. The message + * will be received by "processRoomMessageEvent" in "signaling.js". + * + * @param Room $room + * @param array $message + */ + public function sendRoomMessage($room, $message) { + $this->backendRequest('/api/v1/room/' . $room->getToken(), [ + 'type' => 'message', + 'message' => [ + 'data' => $message, + ], + ]); + } + } |