Class: BaseClient
BaseClient is the base class for any client tasked with interacting with =nil; BaseClient
Extends
RPCClient
Extended by
Constructors
new BaseClient()
new BaseClient(config): BaseClient
Creates an instance of BaseClient.
Parameters
Parameter | Type | Description |
---|---|---|
| The config to be used in the client. It contains the transport and the shard ID. See IClientBaseConfig. |
Returns
Overrides
RPCClient.constructor
Defined
@nilfoundation/niljs/src/clients/BaseClient.ts:24
Properties
shardId?
optional shardId: number;
The ID of the shard with which the client needs to interact. The shard with this ID will be used in every call made by the client.
Defined
@nilfoundation/niljs/src/clients/BaseClient.ts:17
transport
readonly transport: ITransport;
The ITransport to be used in the client. See ITransport.
Inherited from
RPCClient.transport
Defined
@nilfoundation/niljs/src/clients/RPCCleint.ts:27
Methods
getShardId()
getShardId(): undefined | number
Returns the shard ID.
Returns
undefined
| number
The shard ID.
Defined
@nilfoundation/niljs/src/clients/BaseClient.ts:33
request()
protected request<T>(requestObject): Promise<T>
Sends a request.
Type Parameters
Type Parameter |
---|
|
Parameters
Parameter | Type | Description |
---|---|---|
|
| The request object. It contains the request method and parameters. |
Returns
Promise
<T
>
The response.
Inherited from
RPCClient.request
Defined
@nilfoundation/niljs/src/clients/RPCCleint.ts:46
setShardId()
setShardId(shardId): void
Sets the shard ID.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The shard ID. |
Returns
void
Throws
Will throw an error if the provided shard ID is invalid.
Example
client.setShardId(1);
Defined
@nilfoundation/niljs/src/clients/BaseClient.ts:44