|
|
@@ -98,6 +98,10 @@ class SocketServer extends Command
|
|
|
public function open($ws, $request)
|
|
|
{
|
|
|
$date = date('Y-m-d H:i:s');
|
|
|
+ $logFile = '/storage/logs/swoole-task-'.date('Y-m-d', time() - 86400).'.log';
|
|
|
+ if(file_exists(base_path().$logFile)){
|
|
|
+ unlink(base_path().$logFile);
|
|
|
+ }
|
|
|
$this->ws->push($request->fd, json_encode(['success' => 'true', 'op' => 'conn', 'message' => '连接成功', 'fd' => $request->fd], 256));
|
|
|
$this->info("【{$date}】Socket:客户端【{$request->fd}】连接成功");
|
|
|
}
|