Refactor session handling and improve data reliability.
This commit is contained in:
parent
014b63705b
commit
ea3de13cf8
5 changed files with 84 additions and 20 deletions
|
@ -5,14 +5,12 @@
|
|||
use Socialbox\Classes\RpcClient;
|
||||
use Socialbox\Classes\Utilities;
|
||||
use Socialbox\Exceptions\CryptographyException;
|
||||
use Socialbox\Exceptions\DatabaseOperationException;
|
||||
use Socialbox\Exceptions\ResolutionException;
|
||||
use Socialbox\Exceptions\RpcException;
|
||||
use Socialbox\Objects\ExportedSession;
|
||||
use Socialbox\Objects\KeyPair;
|
||||
use Socialbox\Objects\PeerAddress;
|
||||
use Socialbox\Objects\RpcError;
|
||||
use Socialbox\Objects\RpcRequest;
|
||||
use Socialbox\Objects\Standard\SessionState;
|
||||
|
||||
class SocialClient extends RpcClient
|
||||
{
|
||||
|
@ -43,6 +41,19 @@
|
|||
)->getResponse()->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the current state of the session from the server.
|
||||
*
|
||||
* @return SessionState Returns an instance of SessionState representing the session's current state.
|
||||
* @throws RpcException Thrown if the RPC request fails.
|
||||
*/
|
||||
public function getSessionState(): SessionState
|
||||
{
|
||||
return SessionState::fromArray($this->sendRequest(
|
||||
new RpcRequest('getSessionState', Utilities::randomCrc32())
|
||||
)->getResponse()->getResult());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the privacy policy from the server.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue