HandlerInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: yunwuxin <448901948@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace crmeb\interfaces;
  12. use Swoole\Websocket\Frame;
  13. use think\Request;
  14. interface HandlerInterface
  15. {
  16. /**
  17. * "onOpen" listener.
  18. *
  19. * @param int $fd
  20. * @param Request $request
  21. */
  22. public function onOpen($fd, Request $request);
  23. /**
  24. * "onMessage" listener.
  25. * only triggered when event handler not found
  26. *
  27. * @param Frame $frame
  28. */
  29. public function onMessage(Frame $frame);
  30. /**
  31. * "onClose" listener.
  32. *
  33. * @param int $fd
  34. * @param int $reactorId
  35. */
  36. public function onClose($fd, $reactorId);
  37. }