I am using Pusher webhook of types presence and channel existence, and locally I am using ngrok to proxy the requests to my machine. whenever a webhook request is sent to my local server then it gets received and return 200 status code in ngrok, but, for that exact same request I see "webhook failed due time out" in Pusher debug console. I timed my controller execution using microtime(true) and usually it takes 0.05325984954834 which is lower than the Pusher 3 seconds timeout. what is the problem? how to solve it please?
Here is my code:
public function channelExistance(Request $request){
// return response('ok', 200);
$start = microtime(true);
if($this->requestValid($request)){
foreach ($request->input('events') as $event) {
$name = $event['name'];
$channel_name = $event['channel'];
if(stripos($channel_name, 'presence') === false && stripos($channel_name, 'private') === false){
if($event['name'] == 'channel_occupied'){
$this->manager->channelStarted($channel_name);
}
elseif($event['name'] == 'channel_vacated'){
$this->manager->supporterIsFreed($channel_name);
// return response('ok', 200);
}
}
}
}
$end = microtime(true) - $start;
logger('time taken: '.$end);
header("Status: 200 OK");
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire