-1

I have application in Angular 11 and Laravel. I need display time status every second in html in Angular. Now I have method:

this.uptimeService.getUptimeByUserForToday(userid, newDateNow).subscribe(res => {
    if (res.status === 'Ok') {    
        if (res.item != null) {
            this.currentUptimeDTO = res.item;
        }
    }
});

The request is send over Http every second. I get error 429, too many request. I can set in app/Http/Kernel.php throttle value:

'api' => [
    'throttle:60,1',
],

What is the case when will be a lot of users? This is the only way to refresh time every second on the view in Angular? In C# there is a SignalR that sends a request on a lower layer than Http and packets are smaller than Http packets. In Laravel (PHP) there is only an Http request?

Hedayatullah Sarwary
  • 2,664
  • 3
  • 24
  • 38
Jonson
  • 53
  • 1
  • 8
  • 2
    "lower layer than Http" ? do you mean another protocol ? " I need display time status every second" describe your need a bit more. what do you mean by "time status" ? BTW, you can use SignalR in PHP too, or use socket.io or Laravel Echo. All of them use the protocol WebSocket to communicate. – N69S Jun 26 '21 at 23:52
  • I need to display uptime every second. Your answer is what I wanted know, WebSocket will be right solution, thanks – Jonson Jun 27 '21 at 00:34

1 Answers1

1

Websocket works fine, changing throttle parameter in config in Laravel didn't help. Now I have client in Angular and ws server written in Node and Typescript that is completely bypassess Laravel api

Jonson
  • 53
  • 1
  • 8