Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to alternative sleep function in API webman #354

Open
haidarvm opened this issue Feb 1, 2023 · 1 comment
Open

How to alternative sleep function in API webman #354

haidarvm opened this issue Feb 1, 2023 · 1 comment

Comments

@haidarvm
Copy link

haidarvm commented Feb 1, 2023

I create API applications for alarm notification
Who to add sleep() function without sleep the webman process ?

@walkor
Copy link
Owner

walkor commented Feb 1, 2023

composer require workerman/webman-framework ^1.5.0 && composer require workerman/workerman 5.0.0-beta.1 && composer require revolt/event-loop

Usage

<?php
namespace app\controller;

use support\Request;
use Workerman\Timer;

class IndexController
{
    public function index(Request $request)
    {
        Timer::sleep(1); // <=== Here is nonblocking sleep 
        return response('hello webman');
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants