Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flxxyz/swoole-websocket-and-tcp-and-udp
websocket+tcp+udp混用实例
https://github.com/flxxyz/swoole-websocket-and-tcp-and-udp
swoole swoole-tcp swoole-udp swoole-websocket
Last synced: about 1 month ago
JSON representation
websocket+tcp+udp混用实例
- Host: GitHub
- URL: https://github.com/flxxyz/swoole-websocket-and-tcp-and-udp
- Owner: flxxyz
- License: mit
- Created: 2018-08-08T01:57:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-12T09:30:07.000Z (almost 6 years ago)
- Last Synced: 2024-04-23T10:27:02.901Z (8 months ago)
- Topics: swoole, swoole-tcp, swoole-udp, swoole-websocket
- Language: PHP
- Size: 16.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swoole websocket and tcp and udp
## 介绍
一个基于swoole的封装程序## 实例
```php
$config = [
'timezone' => 'Asia/Shanghai',
'tick_interval_timer' => 30, //秒
'websocket' => [
'enable' => true,
'host' => '0.0.0.0',
'port' => '9000',
'type' => SWOOLE_SOCK_TCP,
'setting' => [
'daemonize' => false,
'task_worker_num' => 1,
],
'handler' => \swoole_websocket_and_tcp_and_udp_test\webscoket::class,
],
'http' => [
'enable' => true,
'host' => '0.0.0.0',
'port' => '9001',
'type' => SWOOLE_SOCK_TCP,
'setting' => [],
'handler' => \swoole_websocket_and_tcp_and_udp_test\http::class,
],
'tcp' => [
'enable' => true,
'host' => '0.0.0.0',
'port' => '9002',
'type' => SWOOLE_SOCK_TCP,
'setting' => [
'open_eof_check' => true,
'package_eof' => "\r\n",
'dispatch_mode' => 2,
'heartbeat_check_interval' => 30,
'heartbeat_idle_time' => 60,
],
'handler' => \swoole_websocket_and_tcp_and_udp_test\tcp::class,
],
'udp' => [
'enable' => true,
'host' => '0.0.0.0',
'port' => '9003',
'type' => SWOOLE_SOCK_UDP,
'setting' => [
'open_eof_check' => true,
'package_eof' => "\r\n",
],
'handler' => '',
],
];$server = new \swoole_websocket_and_tcp_and_udp\Server($config);
$server->run();
```## 任务
- [x] 监听websocket
- [x] 监听http
- [x] 监听tcp
- [x] 监听udp
- [x] 混合监听## 感谢
[laravel-s](https://github.com/hhxsv5/laravel-s)项目给予很大的灵感,谢谢