diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-09-08 18:46:27 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-09-08 18:46:27 +0200 |
commit | 70abce04827517d4391cc1bb3cd71574fc19724a (patch) | |
tree | a744a503ed1ef283949b3995d04cb58cf0ed1373 /lib/public | |
parent | ffee4da397d8f74f8e4ce4f479c2a9447e60477c (diff) | |
parent | fa3393674c854e884abf10d3b82dab03aca83c61 (diff) | |
download | nextcloud-server-70abce04827517d4391cc1bb3cd71574fc19724a.tar.gz nextcloud-server-70abce04827517d4391cc1bb3cd71574fc19724a.zip |
Merge pull request #10739 from owncloud/eventsource-public
Add EventSource to the public API
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/ieventsource.php | 34 | ||||
-rw-r--r-- | lib/public/iservercontainer.php | 7 |
2 files changed, 41 insertions, 0 deletions
diff --git a/lib/public/ieventsource.php b/lib/public/ieventsource.php new file mode 100644 index 00000000000..eb7853c5e90 --- /dev/null +++ b/lib/public/ieventsource.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OCP; + +/** + * wrapper for server side events (http://en.wikipedia.org/wiki/Server-sent_events) + * includes a fallback for older browsers and IE + * + * use server side events with caution, to many open requests can hang the server + * + * The event source will initialize the connection to the client when the first data is sent + */ +interface IEventSource { + /** + * send a message to the client + * + * @param string $type + * @param mixed $data + * + * if only one parameter is given, a typeless message will be send with that parameter as data + */ + public function send($type, $data = null); + + /** + * close the connection of the event source + */ + public function close(); +} diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 60b0b497c54..1abf0d9938d 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -235,4 +235,11 @@ interface IServerContainer { * @return \OCP\ICertificateManager */ function getCertificateManager($user = null); + + /** + * Create a new event source + * + * @return \OCP\IEventSource + */ + function createEventSource(); } |