diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-10-03 09:56:12 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-10-20 04:49:07 +0300 |
commit | 9eb3611db559a380a561e80892759fcb4db47a25 (patch) | |
tree | 332aa396c5e08e7a586e50bd2ffb5ce3cf69d1ef /appinfo | |
parent | 4f0a97896e0ee56125c6d5a6fda241d16009370e (diff) |
Add controller for chat messages
The ChatController uses a long-polling approach: if there are currently
no messages the response will not be sent immediately; instead, HTTP
connection will be kept open waiting for new messages to arrive and,
when they do, then the response will be sent.
The technique is simply based on the fact that ChatManager will wait
(hang) until there are some messages to be returned, or until the
timeout expires.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'appinfo')
-rw-r--r-- | appinfo/routes.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php index 012acfefe..d6bab70cc 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -84,6 +84,25 @@ return [ ], [ + 'name' => 'Chat#receiveMessages', + 'url' => '/api/{apiVersion}/chat/{token}', + 'verb' => 'GET', + 'requirements' => [ + 'apiVersion' => 'v1', + 'token' => '^[a-z0-9]{4,30}$', + ], + ], + [ + 'name' => 'Chat#sendMessage', + 'url' => '/api/{apiVersion}/chat/{token}', + 'verb' => 'POST', + 'requirements' => [ + 'apiVersion' => 'v1', + 'token' => '^[a-z0-9]{4,30}$', + ], + ], + + [ 'name' => 'Room#getRooms', 'url' => '/api/{apiVersion}/room', 'verb' => 'GET', |