1
0

IEventSource.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP;
  8. /**
  9. * wrapper for server side events (http://en.wikipedia.org/wiki/Server-sent_events)
  10. * includes a fallback for older browsers and IE
  11. *
  12. * use server side events with caution, to many open requests can hang the server
  13. *
  14. * The event source will initialize the connection to the client when the first data is sent
  15. * @since 8.0.0
  16. */
  17. interface IEventSource {
  18. /**
  19. * send a message to the client
  20. *
  21. * @param string $type One of success, notice, error, failure and done. Used in core/js/update.js
  22. * @param mixed $data
  23. * @return void
  24. *
  25. * if only one parameter is given, a typeless message will be send with that parameter as data
  26. * @since 8.0.0
  27. */
  28. public function send($type, $data = null);
  29. /**
  30. * close the connection of the event source
  31. * @return void
  32. * @since 8.0.0
  33. */
  34. public function close();
  35. }