简体   繁体   中英

LaravelFacebookSDK Operation timed out after 0 milliseconds with 0 out of 0 bytes received

How I can increment the timeout from the laravelfacebooksdk, i get the error:

[Facebook\\Exceptions\\FacebookSDKException] Operation timed out after 0 milliseconds with 0 out of 0 bytes received

Note that i use the wrapper laravel facebook sdk

I modified this files to allow a new http_client_handler I create a new instance and in this updated the htt_client_handler, updated the composer.json for read the Facebooksdk classes.

composer.json

"autoload": {"classmap":
["database","/var/www/laravel/vendor/facebook/graph-sdk/src/Facebook"]

class xxx.php

class LongerTimeoutHttpClient extends 
Facebook\HttpClients\FacebookStreamHttpClient
{public function send($url, $method, $body, array $headers, $timeOut){
$timeOut *= 4;
return parent::send($url, $method, $body, $headers, $timeOut);}}

public function handle(SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb)
{ 
$fbStream = new Facebook\HttpClients\FacebookStream;
$fb2 = $fb->newInstance([
'app_id' => env('FACEBOOK_APP_ID'),
'app_secret' => env('FACEBOOK_APP_SECRET'),
'default_graph_version' => 'v2.9',
'http_client_handler' => new LongerTimeoutHttpClient($fbStream),]);
}

In this way i allow the value timeout in the instances $fb.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM