Component.php 978 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Ratchet\Mock;
  3. use Ratchet\MessageComponentInterface;
  4. use Ratchet\WebSocket\WsServerInterface;
  5. use Ratchet\ConnectionInterface;
  6. class Component implements MessageComponentInterface, WsServerInterface {
  7. public $last = array();
  8. public $protocols = array();
  9. public function __construct(ComponentInterface $app = null) {
  10. $this->last[__FUNCTION__] = func_get_args();
  11. }
  12. public function onOpen(ConnectionInterface $conn) {
  13. $this->last[__FUNCTION__] = func_get_args();
  14. }
  15. public function onMessage(ConnectionInterface $from, $msg) {
  16. $this->last[__FUNCTION__] = func_get_args();
  17. }
  18. public function onClose(ConnectionInterface $conn) {
  19. $this->last[__FUNCTION__] = func_get_args();
  20. }
  21. public function onError(ConnectionInterface $conn, \Exception $e) {
  22. $this->last[__FUNCTION__] = func_get_args();
  23. }
  24. public function getSubProtocols() {
  25. return $this->protocols;
  26. }
  27. }