It is PHP API client for Steem/GOLOS blockchain
Github or packagist with MIT license. Author @t3ran13 and active contributor
@semasping
The main idea of this contribution is testing and ordering nodes in connector by timeout. All down or slow nodes will be skip and faster nodes will be in top. It is enough to test only 1 time during each php process. Each command will be know state of connector after privious. It is awesome for cron scripts with many call to api.
If you use HTTP connectors from php-graphene-node-client you have to update HTTP connectors nemes as below
//was
use GrapheneNodeClient\Connectors\Http\SteemitHttpConnector;
$connector = new SteemitHttpConnector(500);
//now
use GrapheneNodeClient\Connectors\Http\SteemitHttpJsonRpcConnector;
$connector = new SteemitHttpJsonRpcConnector(500);
//if you extend abstract connector
//was
use GrapheneNodeClient\Connectors\Http\HttpConnectorAbstract;
class SteemitHttpConnector extends HttpConnectorAbstract
{
...
}
//now
use GrapheneNodeClient\Connectors\Http\HttpJsonRpcConnectorAbstract;
class SteemitHttpJsonRpcConnector extends HttpJsonRpcConnectorAbstract
{
...
}
'fguillot/json-rpc' was removed from composer.json and HTTP connector use native CURL.
Cool feature for scripts where you call to nodes many times, for example in cron script.
When you init connector you can set answer timeout in sec for WS and ms for HTTP, if nodes do not pass it it will be removed from nodes list $nodeURL and passed nodes will be ordered by timeout.
how to use
//WS
use GrapheneNodeClient\Connectors\WebSocket\SteemitWSConnector;
$connector = new SteemitWSConnector(1); //1 sec only during test of timeouts
//HTTP
use GrapheneNodeClient\Connectors\Http\SteemitHttpJsonRpcConnector;
$connector = new SteemitHttpJsonRpcConnector(500); //500 ms only during test of timeouts
If you extend HttpJsonRpcConnectorAbstract/WSConnectorAbstract you have to modify property $nodeURL to static as below
//was
class * extends HttpJsonRpcConnectorAbstract
{
/**
* https or http server
*
* if you set several nodes urls, if with first node will be trouble
* it will connect after $maxNumberOfTriesToCallApi tries to next node
*
* @var string
*/
protected $nodeURL = ['https://steemd.privex.io', 'https://rpc.steemviz.com', 'https://api.steemit.com', 'https://rpc.buildteam.io', 'https://steemd.pevo.science', 'https://steemd.minnowsupportproject.org'];
}
//now
class * extends HttpJsonRpcConnectorAbstract
{
/**
* https or http server
*
* if you set several nodes urls, if with first node will be trouble
* it will connect after $maxNumberOfTriesToCallApi tries to next node
*
* @var string
*/
protected static $nodeURL = ['https://steemd.privex.io', 'https://rpc.steemviz.com', 'https://api.steemit.com', 'https://rpc.buildteam.io', 'https://steemd.pevo.science', 'https://steemd.minnowsupportproject.org'];
}
When you connected to reserve node old connection do not closed, it was fixed
default nodes:
There is no public HTTP api nodes for GOLOS, you need own node and set up HTTP
It is better with each commit
Commits were done by me for release v4.0.3