* [ ] 本次示例以 [thinkphp5](https://ihavenolimitations.xyz/manual/thinkphp5/118003) 做示例
1. 首先在宝塔中添加站点,下载 tp5 源码安装进去


2. 下载 GateIm,建议使用 composer
运行 composer require xiehaohong/gateim,提示下方内容则代表已经安装成功
若提示其他内容,则为安装失败,请检测comoiser是否安装
~~~
// 安装命令
composer require xiehaohong/gateim
~~~


3. 由于GateIm 是在 cli 命令行模式下运行的,所以需要创建自定义命令行
* 第一步,配置command.php文件,目录在application/command.php
```
return [
'app\index\command\GateIm',
];
```
* 第二步,建立命令类文件,新建application/index/command/GateIm.php
```
<?php
namespace app\index\command;
use gateim\library\server\Swooles;
use think\console\Command;
use think\console\Input;
use think\console\Output;
class GateIm extends Command
{
protected function configure()
{
$this->setName('gateim')->setDescription('Here is the remark ');
}
protected function execute(Input $input, Output $output)
{
new Swooles();
}
}
```
4. 打开服务,出现这个信息代表运行成功

5. 前端测试是否可以连接成功
websocket在线测试地址:[http://www.websocket-test.com/](http://www.websocket-test.com/)

7. 要在项目中对连接的客户端做如发送信息等操作,看后面调用方法中的
[【fd,uid,group_id 关系】](fd%EF%BC%8Cuid%EF%BC%8Cgroup_id%E5%85%B3%E7%B3%BB.md)
[【发送操作请求】](%E5%8F%91%E9%80%81%E6%93%8D%E4%BD%9C%E8%AF%B7%E6%B1%82.md)
[【提供方法】](%E6%8F%90%E4%BE%9B%E6%96%B9%E6%B3%95.md)
