access_client.php 811 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 2017/12/24
  6. * Time: 下午1:05
  7. */
  8. namespace room;
  9. use search\tcp_client;
  10. class access_client extends tcp_client
  11. {
  12. protected static $stInstance;
  13. public function __construct()
  14. {
  15. parent::__construct();
  16. $this->mBodyType = tcp_client::JsonType;
  17. }
  18. public static function instance()
  19. {
  20. if(self::$stInstance == null) {
  21. self::$stInstance = new factory_client();
  22. }
  23. return self::$stInstance;
  24. }
  25. public function __destruct()
  26. {
  27. parent::__destruct();
  28. }
  29. public function remote_addr()
  30. {
  31. global $config;
  32. $host = $config['room_srv']['host'];
  33. $port = $config['room_srv']['port'];
  34. return "tcp://{$host}:{$port}";
  35. }
  36. }