#
Class: SyncRequestA system which provides an easy way to synchronize data between game clients.
The data will be split into chunks and sent in order until all of them are recieved by
every player. Splitting the data is required as BlzSendSyncData
only allows 255 characters
per request.
example
const data = File.read("savecode.txt");
// Synchronize the contents of the file from the first player's computer.new SyncRequest(Players[0], data).then((res, req) => { print(res.data);});
#
Hierarchy- SyncRequest
#
Constructors#
constructornew SyncRequest(from: MapPlayer): SyncRequest
Creates a new sync request.
#
Parameters:Name | Type | Description |
---|---|---|
from | MapPlayer | The player to send the data from. |
Returns: SyncRequest
Defined in: system/sync.ts:116
new SyncRequest(from: MapPlayer, data: string): SyncRequest
Creates a new sync request and immediately attempts to send the data.
#
Parameters:Name | Type | Description |
---|---|---|
from | MapPlayer | The player to send the data from. |
data | string | The data to send. |
Returns: SyncRequest
Defined in: system/sync.ts:122
#
Properties#
from• Readonly
from: MapPlayer
Defined in: system/sync.ts:100
#
id• Readonly
id: number
Defined in: system/sync.ts:101
#
options• Readonly
options: ISyncOptions
Defined in: system/sync.ts:102
#
Accessors#
startTimestartTime(): number
Get the time that the sync request started syncing.
Returns: number
Defined in: system/sync.ts:153
#
Methods#
catchcatch(callback: SyncCallback): SyncRequest
Sets the callback for when a request failed.
#
Parameters:Name | Type | Description |
---|---|---|
callback | SyncCallback |
Returns: SyncRequest
Defined in: system/sync.ts:161
#
destroydestroy(): void
Recycles the request index and prevents it from sending any more data.
Returns: void
Defined in: system/sync.ts:169
#
startstart(data: string): boolean
Start syncing
#
Parameters:Name | Type | Description |
---|---|---|
data | string | The data to sync. If data was passed to the constructor then nothing will happen. |
Returns: boolean
Defined in: system/sync.ts:179
#
thenthen(callback: SyncCallback): SyncRequest
Sets the callback for when a request has sucessfully synchronized.
#
Parameters:Name | Type | Description |
---|---|---|
callback | SyncCallback |
Returns: SyncRequest
Defined in: system/sync.ts:217
#
fromIndexstatic fromIndex(index: number): SyncRequest
Retrieve a request based on it's index
#
Parameters:Name | Type | Description |
---|---|---|
index | number | The request index |
Returns: SyncRequest
Defined in: system/sync.ts:251