WampComponent.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Ratchet\Mock;
  3. use Ratchet\Wamp\WampServerInterface;
  4. use Ratchet\WebSocket\WsServerInterface;
  5. use Ratchet\ConnectionInterface;
  6. class WampComponent implements WampServerInterface, WsServerInterface {
  7. public $last = array();
  8. public $protocols = array();
  9. public function getSubProtocols() {
  10. return $this->protocols;
  11. }
  12. public function onCall(ConnectionInterface $conn, $id, $procURI, array $params) {
  13. $this->last[__FUNCTION__] = func_get_args();
  14. }
  15. public function onSubscribe(ConnectionInterface $conn, $topic) {
  16. $this->last[__FUNCTION__] = func_get_args();
  17. }
  18. public function onUnSubscribe(ConnectionInterface $conn, $topic) {
  19. $this->last[__FUNCTION__] = func_get_args();
  20. }
  21. public function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible) {
  22. $this->last[__FUNCTION__] = func_get_args();
  23. }
  24. public function onOpen(ConnectionInterface $conn) {
  25. $this->last[__FUNCTION__] = func_get_args();
  26. }
  27. public function onClose(ConnectionInterface $conn) {
  28. $this->last[__FUNCTION__] = func_get_args();
  29. }
  30. public function onError(ConnectionInterface $conn, \Exception $e) {
  31. $this->last[__FUNCTION__] = func_get_args();
  32. }
  33. }