-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add PHPSocketIO
- Loading branch information
lobtao
committed
May 11, 2018
1 parent
d3e1aef
commit e285722
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Created by lobtao. | ||
* Date: 2018/5/11 | ||
* Time: 上午11:26 | ||
*/ | ||
|
||
namespace lobtao\tp5helper; | ||
|
||
|
||
use PHPSocketIO\SocketIO; | ||
use Workerman\Worker; | ||
|
||
abstract class PHPSocketIO | ||
{ | ||
protected $io; | ||
protected $opts = []; | ||
protected $port = '9982'; | ||
|
||
/** | ||
* 架构函数 | ||
* @access public | ||
*/ | ||
public function __construct() { | ||
|
||
// 实例化 SocketIO 服务 | ||
$this->io = new SocketIO($this->port, $this->opts); | ||
// 初始化 | ||
$this->init(); | ||
// Run worker | ||
Worker::runAll(); | ||
} | ||
|
||
protected function init() { | ||
} | ||
} |