ConnectionException.php 773 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Copyright (C) 2014-2022 Textalk/Abicart and contributors.
  4. *
  5. * This file is part of Websocket PHP and is free software under the ISC License.
  6. * License text: https://raw.githubusercontent.com/Textalk/websocket-php/master/COPYING
  7. */
  8. namespace WebSocket;
  9. use Throwable;
  10. class ConnectionException extends Exception
  11. {
  12. // Native codes in interval 0-106
  13. public const TIMED_OUT = 1024;
  14. public const EOF = 1025;
  15. public const BAD_OPCODE = 1026;
  16. private $data;
  17. public function __construct(string $message, int $code = 0, array $data = [], Throwable $prev = null)
  18. {
  19. parent::__construct($message, $code, $prev);
  20. $this->data = $data;
  21. }
  22. public function getData(): array
  23. {
  24. return $this->data;
  25. }
  26. }