forked from matyhtf/webim
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebim_server.php
More file actions
31 lines (25 loc) · 708 Bytes
/
webim_server.php
File metadata and controls
31 lines (25 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
define('DEBUG', 'on');
define('WEBPATH', __DIR__);
/**
* /vendor/autoload.php是Composer工具生成的
* shell: composer update
*/
require __DIR__.'/vendor/autoload.php';
/**
* Swoole框架自动载入器初始化
*/
Swoole\Loader::vendor_init();
/**
* 注册命名空间到自动载入器中
*/
Swoole\Loader::addNameSpace('WebIM', __DIR__.'/src/');
$config = require __DIR__.'/config.php';
$webim = new WebIM\Server($config);
$webim->loadSetting(__DIR__."/swoole.ini"); //加载配置文件
/**
* webim必须使用swoole扩展
*/
$server = new Swoole\Network\Server($config['server']['host'], $config['server']['port']);
$server->setProtocol($webim);
$server->run($config['swoole']);