老师在赛事直播的时候看视频发现俩个问题
来源:8-17 赛事直播功能开发-优化
SunXQ_
2018-05-24
就是上传图片的时候第一次没有问题第二次就有问题了 终端报错
在赛事直播最后一张优化的那节 消息是发送成功了 可以终端报错
5回答
-
不吃鱼的喵儿
2019-01-06
Swoole\WebSocket\Server::push(): the connected client of connection[7] is not a websocket client or closed
这个问题刚刚查了下资料,,解释一下吧
这个错误信息表示fd 1不是WebSocket连接,所以不能向它推送数据
所以 必须判断连接的状态码
解决代码如下:
$a= $serv->connection_info($fd); if($a && isset($a["websocket_status"]) && intval($a["websocket_status"])>0){ $serv->push($fd,json_encode($data)); }
官方也给了相应的文档:https://wiki.swoole.com/wiki/page/490.html,不懂的可以查阅这里。或者
每次断开的时候,一定要删除 redis里的集合,也就是课文中讲的live_game_key
112019-01-19 -
我丑我妈爱我
2018-06-22
我也遇到了你的第二个问题,请问下最后怎么解决的?
012018-06-22 -
singwa
2018-05-25
建议代码打包发我。
022018-05-25 -
SunXQ_
提问者
2018-05-24
第二个错误
PHP Fatal error: Uncaught think\exception\ErrorException: Swoole\WebSocket\Server::push(): the connected client of connection[12] is not a websocket client. in /data/www/Small_swoole/application/common/lib/task/Task.php:31
Stack trace:
#0 [internal function]: think\Error::appError(2, 'Swoole\\WebSocke...', '/data/www/Small...', 31, Array)
#1 /data/www/Small_swoole/application/common/lib/task/Task.php(31): Swoole\WebSocket\Server->push('12', '{"type":1,"titl...')
#2 /data/www/Small_swoole/server/ws.php(105): app\common\lib\task\Task->pushLive(Array, Object(Swoole\WebSocket\Server))
#3 [internal function]: Ws->onTask(Object(Swoole\WebSocket\Server), 1, 2, Array)
#4 {main}
thrown in /data/www/Small_swoole/application/common/lib/task/Task.php on line 31
[think\exception\ErrorException]
Uncaught think\exception\ErrorException: Swoole\WebSocket\Server::push(): the connected client of connection[12] is not a websocket client. in /data/www/Small_swoole/a
pplication/common/lib/task/Task.php:31
Stack trace:
#0 [internal function]: think\Error::appError(2, 'Swoole\\WebSocke...', '/data/www/Small...', 31, Array)
#1 /data/www/Small_swoole/application/common/lib/task/Task.php(31): Swoole\WebSocket\Server->push('12', '{"type":1,"titl...')
#2 /data/www/Small_swoole/server/ws.php(105): app\common\lib\task\Task->pushLive(Array, Object(Swoole\WebSocket\Server))
#3 [internal function]: Ws->onTask(Object(Swoole\WebSocket\Server), 1, 2, Array)
#4 {main}
thrown
Exception trace:
() at /data/www/Small_swoole/application/common/lib/task/Task.php:31
think\Error::appShutdown() at n/a:n/a
[2018-05-24 21:57:15 ^6418.5] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught think\exception\ErrorException: Swoole\WebSocket\Server::push(): the connected client of connection[12] is not a websocket client. in /data/www/Small_swoole/application/common/lib/task/Task.php:31
Stack trace:
#0 [internal function]: think\Error::appError(2, 'Swoole\\WebSocke...', '/data/www/Small...', 31, Array)
#1 /data/www/Small_swoole/application/common/lib/task/Task.php(31): Swoole\WebSocket\Server->push('12', '{"type":1,"titl...')
#2 /data/www/S
[2018-05-24 21:57:15 $6415.0] WARNING swManager_check_exit_status: worker#5 abnormal exit, status=255, signal=0
00 -
SunXQ_
提问者
2018-05-24
第一个错误
PHP Fatal error: Uncaught Error: Call to a member function move() on null in /data/www/Small_swoole/application/admin/controller/Image.php:9
Stack trace:
#0 [internal function]: app\admin\controller\Image->index()
#1 /data/www/Small_swoole/thinkphp/library/think/Container.php(186): ReflectionMethod->invokeArgs(Object(app\admin\controller\Image), Array)
#2 /data/www/Small_swoole/thinkphp/library/think/route/dispatch/Module.php(126): think\Container->invokeMethod(Array, Array)
#3 /data/www/Small_swoole/thinkphp/library/think/route/dispatch/Url.php(26): think\route\dispatch\Module->run()
#4 /data/www/Small_swoole/thinkphp/library/think/App.php(309): think\route\dispatch\Url->run()
#5 /data/www/Small_swoole/server/ws.php(90): think\App->run()
#6 {main}
thrown in /data/www/Small_swoole/application/admin/controller/Image.php on line 9
[think\exception\ErrorException]
Uncaught Error: Call to a member function move() on null in /data/www/Small_swoole/application/admin/controller/Image.php:9
Stack trace:
#0 [internal function]: app\admin\controller\Image->index()
#1 /data/www/Small_swoole/thinkphp/library/think/Container.php(186): ReflectionMethod->invokeArgs(Object(app\admin\controller\Image), Array)
#2 /data/www/Small_swoole/thinkphp/library/think/route/dispatch/Module.php(126): think\Container->invokeMethod(Array, Array)
#3 /data/www/Small_swoole/thinkphp/library/think/route/dispatch/Url.php(26): think\route\dispatch\Module->run()
#4 /data/www/Small_swoole/thinkphp/library/think/App.php(309): think\route\dispatch\Url->run()
#5 /data/www/Small_swoole/server/ws.php(90): think\App->run()
#6 {main}
thrown
Exception trace:
() at /data/www/Small_swoole/application/admin/controller/Image.php:9
think\Error::appShutdown() at n/a:n/a
[2018-05-24 21:56:10 *6482.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function move() on null in /data/www/Small_swoole/application/admin/controller/Image.php:9
Stack trace:
#0 [internal function]: app\admin\controller\Image->index()
#1 /data/www/Small_swoole/thinkphp/library/think/Container.php(186): ReflectionMethod->invokeArgs(Object(app\admin\controller\Image), Array)
#2 /data/www/Small_swoole/thinkphp/library/think/route/dispatch/Module.php(126): think\Container->invokeMethod(Array, Array)
#
[2018-05-24 21:56:10 $6415.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0
00
相似问题