event_looper.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 2017/12/14
  6. * Time: 下午2:28
  7. */
  8. require_once(BASE_ROOT_PATH . '/helper/event/IProcessor.php');
  9. //require_once(BASE_ROOT_PATH . '/helper/event/event_looper.php');
  10. //require_once(BASE_ROOT_PATH . '/helper/event/buffer_looper.php');
  11. require_once(BASE_ROOT_PATH . '/helper/event/EventLooper.php');
  12. require_once(BASE_ROOT_PATH . '/helper/event/util.php');
  13. class process_looper extends event\EventLooper
  14. {
  15. private static $stInstance;
  16. public static function instance()
  17. {
  18. if(self::$stInstance == null) {
  19. self::$stInstance = new process_looper();
  20. }
  21. return self::$stInstance;
  22. }
  23. }
  24. class empty_processor implements event\IProcessor
  25. {
  26. public function __construct()
  27. {
  28. }
  29. public function onStart()
  30. {
  31. }
  32. public function onConnected($bufid,$stream,$host,$port,$args)
  33. {
  34. }
  35. public function onRequest($bufid, $body)
  36. {
  37. $input = json_decode($body,true);
  38. if($input == false) {
  39. return false;
  40. }
  41. }
  42. public function onClose($bufid)
  43. {
  44. }
  45. }