@minecraft/server-net 1.0.0-beta.1.26.2-stable → 1.0.0-beta.1.26.20-preview.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/index.d.ts +356 -49
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# `@minecraft/server-net`
|
|
2
|
-
|
|
3
|
-
The `@minecraft/server-net` module contains types for executing HTTP-based requests. This module can only be used on Bedrock Dedicated Server. These APIs do not function within the Minecraft game client or within Minecraft Realms.
|
|
4
|
-
|
|
5
|
-
## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
|
|
6
|
-
|
|
7
|
-
See full documentation for this module here:
|
|
8
|
-
|
|
1
|
+
# `@minecraft/server-net`
|
|
2
|
+
|
|
3
|
+
The `@minecraft/server-net` module contains types for executing HTTP-based requests. This module can only be used on Bedrock Dedicated Server. These APIs do not function within the Minecraft game client or within Minecraft Realms.
|
|
4
|
+
|
|
5
|
+
## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
|
|
6
|
+
|
|
7
|
+
See full documentation for this module here:
|
|
8
|
+
|
|
9
9
|
https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server-net/minecraft-server-net
|
package/index.d.ts
CHANGED
|
@@ -51,6 +51,14 @@ export enum HttpRequestMethod {
|
|
|
51
51
|
*
|
|
52
52
|
*/
|
|
53
53
|
Head = 'Head',
|
|
54
|
+
/**
|
|
55
|
+
* @remarks
|
|
56
|
+
* Represents the method for an HTTP PATCH request. PATCH
|
|
57
|
+
* requests are commonly used to apply partial modifications to
|
|
58
|
+
* a resource.
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
Patch = 'Patch',
|
|
54
62
|
/**
|
|
55
63
|
* @remarks
|
|
56
64
|
* Represents the method for an HTTP POST request. POST
|
|
@@ -107,9 +115,10 @@ export enum PacketId {
|
|
|
107
115
|
ChangeDimensionPacket = 'ChangeDimensionPacket',
|
|
108
116
|
ChangeMobPropertyPacket = 'ChangeMobPropertyPacket',
|
|
109
117
|
ChunkRadiusUpdatedPacket = 'ChunkRadiusUpdatedPacket',
|
|
118
|
+
ClientboundAttributeLayerSyncPacket = 'ClientboundAttributeLayerSyncPacket',
|
|
110
119
|
ClientboundCloseFormPacket = 'ClientboundCloseFormPacket',
|
|
111
120
|
ClientboundControlSchemeSetPacket = 'ClientboundControlSchemeSetPacket',
|
|
112
|
-
|
|
121
|
+
ClientboundDataDrivenUICloseScreenPacket = 'ClientboundDataDrivenUICloseScreenPacket',
|
|
113
122
|
ClientboundDataDrivenUIReloadPacket = 'ClientboundDataDrivenUIReloadPacket',
|
|
114
123
|
ClientboundDataDrivenUIShowScreenPacket = 'ClientboundDataDrivenUIShowScreenPacket',
|
|
115
124
|
ClientboundDataStorePacket = 'ClientboundDataStorePacket',
|
|
@@ -138,7 +147,6 @@ export enum PacketId {
|
|
|
138
147
|
CreativeContentPacket = 'CreativeContentPacket',
|
|
139
148
|
CurrentStructureFeaturePacket = 'CurrentStructureFeaturePacket',
|
|
140
149
|
DeathInfoPacket = 'DeathInfoPacket',
|
|
141
|
-
DebugDrawerPacket = 'DebugDrawerPacket',
|
|
142
150
|
DebugInfoPacket = 'DebugInfoPacket',
|
|
143
151
|
DimensionDataPacket = 'DimensionDataPacket',
|
|
144
152
|
DisconnectPacket = 'DisconnectPacket',
|
|
@@ -170,6 +178,7 @@ export enum PacketId {
|
|
|
170
178
|
LevelEventGenericPacket = 'LevelEventGenericPacket',
|
|
171
179
|
LevelEventPacket = 'LevelEventPacket',
|
|
172
180
|
LevelSoundEventPacket = 'LevelSoundEventPacket',
|
|
181
|
+
LocatorBarPacket = 'LocatorBarPacket',
|
|
173
182
|
LoginPacket = 'LoginPacket',
|
|
174
183
|
MapCreateLockedCopyPacket = 'MapCreateLockedCopyPacket',
|
|
175
184
|
MapInfoRequestPacket = 'MapInfoRequestPacket',
|
|
@@ -192,6 +201,7 @@ export enum PacketId {
|
|
|
192
201
|
OnScreenTextureAnimationPacket = 'OnScreenTextureAnimationPacket',
|
|
193
202
|
OpenSignPacket = 'OpenSignPacket',
|
|
194
203
|
PacketViolationWarningPacket = 'PacketViolationWarningPacket',
|
|
204
|
+
PartyChangedPacket = 'PartyChangedPacket',
|
|
195
205
|
PhotoTransferPacket = 'PhotoTransferPacket',
|
|
196
206
|
PlayerActionPacket = 'PlayerActionPacket',
|
|
197
207
|
PlayerArmorDamagePacket = 'PlayerArmorDamagePacket',
|
|
@@ -209,6 +219,7 @@ export enum PacketId {
|
|
|
209
219
|
PlayStatusPacket = 'PlayStatusPacket',
|
|
210
220
|
PositionTrackingDBClientRequestPacket = 'PositionTrackingDBClientRequestPacket',
|
|
211
221
|
PositionTrackingDBServerBroadcastPacket = 'PositionTrackingDBServerBroadcastPacket',
|
|
222
|
+
PrimitiveShapesPacket = 'PrimitiveShapesPacket',
|
|
212
223
|
PurchaseReceiptPacket = 'PurchaseReceiptPacket',
|
|
213
224
|
RefreshEntitlementsPacket = 'RefreshEntitlementsPacket',
|
|
214
225
|
RemoveActorPacket = 'RemoveActorPacket',
|
|
@@ -223,17 +234,21 @@ export enum PacketId {
|
|
|
223
234
|
ResourcePackClientResponsePacket = 'ResourcePackClientResponsePacket',
|
|
224
235
|
ResourcePackDataInfoPacket = 'ResourcePackDataInfoPacket',
|
|
225
236
|
ResourcePacksInfoPacket = 'ResourcePacksInfoPacket',
|
|
237
|
+
ResourcePacksReadyForValidationPacket = 'ResourcePacksReadyForValidationPacket',
|
|
226
238
|
ResourcePackStackPacket = 'ResourcePackStackPacket',
|
|
227
239
|
RespawnPacket = 'RespawnPacket',
|
|
228
240
|
ScriptMessagePacket = 'ScriptMessagePacket',
|
|
241
|
+
ServerboundDataDrivenScreenClosedPacket = 'ServerboundDataDrivenScreenClosedPacket',
|
|
229
242
|
ServerboundDataStorePacket = 'ServerboundDataStorePacket',
|
|
230
243
|
ServerboundDiagnosticsPacket = 'ServerboundDiagnosticsPacket',
|
|
231
244
|
ServerboundLoadingScreenPacket = 'ServerboundLoadingScreenPacket',
|
|
232
245
|
ServerboundPackSettingChangePacket = 'ServerboundPackSettingChangePacket',
|
|
233
246
|
ServerPlayerPostMovePositionPacket = 'ServerPlayerPostMovePositionPacket',
|
|
247
|
+
ServerPresenceInfoPacket = 'ServerPresenceInfoPacket',
|
|
234
248
|
ServerSettingsRequestPacket = 'ServerSettingsRequestPacket',
|
|
235
249
|
ServerSettingsResponsePacket = 'ServerSettingsResponsePacket',
|
|
236
250
|
ServerStatsPacket = 'ServerStatsPacket',
|
|
251
|
+
ServerStoreInfoPacket = 'ServerStoreInfoPacket',
|
|
237
252
|
ServerToClientHandshakePacket = 'ServerToClientHandshakePacket',
|
|
238
253
|
SetActorDataPacket = 'SetActorDataPacket',
|
|
239
254
|
SetActorLinkPacket = 'SetActorLinkPacket',
|
|
@@ -270,6 +285,7 @@ export enum PacketId {
|
|
|
270
285
|
SubChunkRequestPacket = 'SubChunkRequestPacket',
|
|
271
286
|
SubClientLoginPacket = 'SubClientLoginPacket',
|
|
272
287
|
SyncActorPropertyPacket = 'SyncActorPropertyPacket',
|
|
288
|
+
SyncWorldClocksPacket = 'SyncWorldClocksPacket',
|
|
273
289
|
TakeItemActorPacket = 'TakeItemActorPacket',
|
|
274
290
|
TextPacket = 'TextPacket',
|
|
275
291
|
TickingAreasLoadStatusPacket = 'TickingAreasLoadStatusPacket',
|
|
@@ -292,25 +308,42 @@ export enum PacketId {
|
|
|
292
308
|
VoxelShapesPacket = 'VoxelShapesPacket',
|
|
293
309
|
}
|
|
294
310
|
|
|
311
|
+
export class CloseAfterEventSignal {
|
|
312
|
+
private constructor();
|
|
313
|
+
/**
|
|
314
|
+
* @remarks
|
|
315
|
+
* This function can't be called in restricted-execution mode.
|
|
316
|
+
*
|
|
317
|
+
* This function can be called in early-execution mode.
|
|
318
|
+
*
|
|
319
|
+
*/
|
|
320
|
+
subscribe(callback: (arg0: WebSocketClientCloseAfterEvent) => void): (arg0: WebSocketClientCloseAfterEvent) => void;
|
|
321
|
+
/**
|
|
322
|
+
* @remarks
|
|
323
|
+
* This function can't be called in restricted-execution mode.
|
|
324
|
+
*
|
|
325
|
+
* This function can be called in early-execution mode.
|
|
326
|
+
*
|
|
327
|
+
*/
|
|
328
|
+
unsubscribe(callback: (arg0: WebSocketClientCloseAfterEvent) => void): void;
|
|
329
|
+
}
|
|
330
|
+
|
|
295
331
|
/**
|
|
296
332
|
* @example simpleHttpRequest.ts
|
|
297
333
|
* ```typescript
|
|
298
334
|
* import { HttpRequest, HttpHeader, HttpRequestMethod, http } from '@minecraft/server-net';
|
|
299
335
|
*
|
|
300
336
|
* async function updateScore() {
|
|
301
|
-
*
|
|
337
|
+
* const req = new HttpRequest('http://localhost:3000/updateScore');
|
|
302
338
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
339
|
+
* req.body = JSON.stringify({
|
|
340
|
+
* score: 22,
|
|
341
|
+
* });
|
|
306
342
|
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* new HttpHeader('Content-Type', 'application/json'),
|
|
310
|
-
* new HttpHeader('auth', 'my-auth-token'),
|
|
311
|
-
* ];
|
|
343
|
+
* req.method = HttpRequestMethod.Post;
|
|
344
|
+
* req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', 'my-auth-token')];
|
|
312
345
|
*
|
|
313
|
-
*
|
|
346
|
+
* await http.request(req);
|
|
314
347
|
* }
|
|
315
348
|
* ```
|
|
316
349
|
*/
|
|
@@ -352,19 +385,16 @@ export class HttpClient {
|
|
|
352
385
|
* import { HttpRequest, HttpHeader, HttpRequestMethod, http } from '@minecraft/server-net';
|
|
353
386
|
*
|
|
354
387
|
* async function updateScore() {
|
|
355
|
-
*
|
|
388
|
+
* const req = new HttpRequest('http://localhost:3000/updateScore');
|
|
356
389
|
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
390
|
+
* req.body = JSON.stringify({
|
|
391
|
+
* score: 22,
|
|
392
|
+
* });
|
|
360
393
|
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* new HttpHeader('Content-Type', 'application/json'),
|
|
364
|
-
* new HttpHeader('auth', 'my-auth-token'),
|
|
365
|
-
* ];
|
|
394
|
+
* req.method = HttpRequestMethod.Post;
|
|
395
|
+
* req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', 'my-auth-token')];
|
|
366
396
|
*
|
|
367
|
-
*
|
|
397
|
+
* await http.request(req);
|
|
368
398
|
* }
|
|
369
399
|
* ```
|
|
370
400
|
*/
|
|
@@ -379,19 +409,16 @@ export class HttpClient {
|
|
|
379
409
|
* import { HttpRequest, HttpHeader, HttpRequestMethod, http } from '@minecraft/server-net';
|
|
380
410
|
*
|
|
381
411
|
* async function updateScore() {
|
|
382
|
-
*
|
|
412
|
+
* const req = new HttpRequest('http://localhost:3000/updateScore');
|
|
383
413
|
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
414
|
+
* req.body = JSON.stringify({
|
|
415
|
+
* score: 22,
|
|
416
|
+
* });
|
|
387
417
|
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
* new HttpHeader('Content-Type', 'application/json'),
|
|
391
|
-
* new HttpHeader('auth', 'my-auth-token'),
|
|
392
|
-
* ];
|
|
418
|
+
* req.method = HttpRequestMethod.Post;
|
|
419
|
+
* req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', 'my-auth-token')];
|
|
393
420
|
*
|
|
394
|
-
*
|
|
421
|
+
* await http.request(req);
|
|
395
422
|
* }
|
|
396
423
|
* ```
|
|
397
424
|
*/
|
|
@@ -422,19 +449,16 @@ export class HttpHeader {
|
|
|
422
449
|
* import { HttpRequest, HttpHeader, HttpRequestMethod, http } from '@minecraft/server-net';
|
|
423
450
|
*
|
|
424
451
|
* async function updateScore() {
|
|
425
|
-
*
|
|
452
|
+
* const req = new HttpRequest('http://localhost:3000/updateScore');
|
|
426
453
|
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
454
|
+
* req.body = JSON.stringify({
|
|
455
|
+
* score: 22,
|
|
456
|
+
* });
|
|
430
457
|
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
* new HttpHeader('Content-Type', 'application/json'),
|
|
434
|
-
* new HttpHeader('auth', 'my-auth-token'),
|
|
435
|
-
* ];
|
|
458
|
+
* req.method = HttpRequestMethod.Post;
|
|
459
|
+
* req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', 'my-auth-token')];
|
|
436
460
|
*
|
|
437
|
-
*
|
|
461
|
+
* await http.request(req);
|
|
438
462
|
* }
|
|
439
463
|
* ```
|
|
440
464
|
*/
|
|
@@ -559,6 +583,28 @@ export class HttpResponse {
|
|
|
559
583
|
readonly status: number;
|
|
560
584
|
}
|
|
561
585
|
|
|
586
|
+
export class MessageAfterEventSignal {
|
|
587
|
+
private constructor();
|
|
588
|
+
/**
|
|
589
|
+
* @remarks
|
|
590
|
+
* This function can't be called in restricted-execution mode.
|
|
591
|
+
*
|
|
592
|
+
* This function can be called in early-execution mode.
|
|
593
|
+
*
|
|
594
|
+
*/
|
|
595
|
+
subscribe(
|
|
596
|
+
callback: (arg0: WebSocketClientReceiveAfterEvent) => void,
|
|
597
|
+
): (arg0: WebSocketClientReceiveAfterEvent) => void;
|
|
598
|
+
/**
|
|
599
|
+
* @remarks
|
|
600
|
+
* This function can't be called in restricted-execution mode.
|
|
601
|
+
*
|
|
602
|
+
* This function can be called in early-execution mode.
|
|
603
|
+
*
|
|
604
|
+
*/
|
|
605
|
+
unsubscribe(callback: (arg0: WebSocketClientReceiveAfterEvent) => void): void;
|
|
606
|
+
}
|
|
607
|
+
|
|
562
608
|
export class NetworkBeforeEvents {
|
|
563
609
|
private constructor();
|
|
564
610
|
/**
|
|
@@ -683,6 +729,97 @@ export class PacketSendBeforeEventSignal {
|
|
|
683
729
|
unsubscribe(callback: (arg0: PacketSendBeforeEvent) => void): void;
|
|
684
730
|
}
|
|
685
731
|
|
|
732
|
+
/**
|
|
733
|
+
* Used to manage WebSocket connections.
|
|
734
|
+
*/
|
|
735
|
+
export class WebSocket {
|
|
736
|
+
private constructor();
|
|
737
|
+
/**
|
|
738
|
+
* @remarks
|
|
739
|
+
* Attempts to connect a WebSocket client.
|
|
740
|
+
*
|
|
741
|
+
* This function can't be called in restricted-execution mode.
|
|
742
|
+
*
|
|
743
|
+
* @param uri
|
|
744
|
+
* URL to make connection to.
|
|
745
|
+
* @returns
|
|
746
|
+
* An awaitable promise that contains the WebSocket client that
|
|
747
|
+
* was connected.
|
|
748
|
+
*/
|
|
749
|
+
connect(uri: string): Promise<WebSocketClient>;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* An active WebSocket client.
|
|
754
|
+
*/
|
|
755
|
+
export class WebSocketClient {
|
|
756
|
+
private constructor();
|
|
757
|
+
/**
|
|
758
|
+
* @remarks
|
|
759
|
+
* Contains a set of events related to this WebSocket client.
|
|
760
|
+
*
|
|
761
|
+
*/
|
|
762
|
+
readonly afterEvents: WebSocketClientAfterEvents;
|
|
763
|
+
/**
|
|
764
|
+
* @remarks
|
|
765
|
+
* Set to true if the socket is current connected to the
|
|
766
|
+
* server.
|
|
767
|
+
*
|
|
768
|
+
*/
|
|
769
|
+
readonly isOpen: boolean;
|
|
770
|
+
/**
|
|
771
|
+
* @remarks
|
|
772
|
+
* Closes the connection with the server.
|
|
773
|
+
*
|
|
774
|
+
* This function can't be called in restricted-execution mode.
|
|
775
|
+
*
|
|
776
|
+
* @throws This function can throw errors.
|
|
777
|
+
*
|
|
778
|
+
* {@link WebSocketNotConnectedError}
|
|
779
|
+
*/
|
|
780
|
+
close(): void;
|
|
781
|
+
/**
|
|
782
|
+
* @remarks
|
|
783
|
+
* Sends the provided payload to the server.
|
|
784
|
+
*
|
|
785
|
+
* This function can't be called in restricted-execution mode.
|
|
786
|
+
*
|
|
787
|
+
* @param payload
|
|
788
|
+
* The payload that will be included in the network packet.
|
|
789
|
+
* @throws This function can throw errors.
|
|
790
|
+
*
|
|
791
|
+
* {@link RequestBodyTooLargeError}
|
|
792
|
+
*
|
|
793
|
+
* {@link WebSocketNotConnectedError}
|
|
794
|
+
*/
|
|
795
|
+
send(payload: string): void;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
export class WebSocketClientAfterEvents {
|
|
799
|
+
private constructor();
|
|
800
|
+
/**
|
|
801
|
+
* @remarks
|
|
802
|
+
* This property can be read in early-execution mode.
|
|
803
|
+
*
|
|
804
|
+
*/
|
|
805
|
+
readonly close: CloseAfterEventSignal;
|
|
806
|
+
/**
|
|
807
|
+
* @remarks
|
|
808
|
+
* This property can be read in early-execution mode.
|
|
809
|
+
*
|
|
810
|
+
*/
|
|
811
|
+
readonly message: MessageAfterEventSignal;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
export class WebSocketClientCloseAfterEvent {
|
|
815
|
+
private constructor();
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
export class WebSocketClientReceiveAfterEvent {
|
|
819
|
+
private constructor();
|
|
820
|
+
readonly message: string;
|
|
821
|
+
}
|
|
822
|
+
|
|
686
823
|
/**
|
|
687
824
|
* Options for events triggered by network packets.
|
|
688
825
|
*/
|
|
@@ -703,6 +840,31 @@ export interface PacketEventOptions {
|
|
|
703
840
|
monitoredPacketIds?: PacketId[];
|
|
704
841
|
}
|
|
705
842
|
|
|
843
|
+
/**
|
|
844
|
+
* An error thrown when the maximum number of concurrent HTTP
|
|
845
|
+
* requests has been reached.
|
|
846
|
+
*/
|
|
847
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
848
|
+
export class HttpRequestLimitExceededError extends Error {
|
|
849
|
+
private constructor();
|
|
850
|
+
/**
|
|
851
|
+
* @remarks
|
|
852
|
+
* Number of requests already in flight when rejected.
|
|
853
|
+
*
|
|
854
|
+
* This property can be read in early-execution mode.
|
|
855
|
+
*
|
|
856
|
+
*/
|
|
857
|
+
readonly inFlightRequests: number;
|
|
858
|
+
/**
|
|
859
|
+
* @remarks
|
|
860
|
+
* Configured maximum concurrent HTTP requests.
|
|
861
|
+
*
|
|
862
|
+
* This property can be read in early-execution mode.
|
|
863
|
+
*
|
|
864
|
+
*/
|
|
865
|
+
readonly maxConcurrentRequests: number;
|
|
866
|
+
}
|
|
867
|
+
|
|
706
868
|
/**
|
|
707
869
|
* An error thrown when a platform-level HTTP error occurs.
|
|
708
870
|
* Information provided in this class may be useful for
|
|
@@ -714,30 +876,175 @@ export class InternalHttpRequestError extends Error {
|
|
|
714
876
|
private constructor();
|
|
715
877
|
/**
|
|
716
878
|
* @remarks
|
|
717
|
-
*
|
|
879
|
+
* This property can be read in early-execution mode.
|
|
880
|
+
*
|
|
881
|
+
*/
|
|
882
|
+
readonly errorCode: number;
|
|
883
|
+
/**
|
|
884
|
+
* @remarks
|
|
885
|
+
* This property can be read in early-execution mode.
|
|
886
|
+
*
|
|
887
|
+
*/
|
|
888
|
+
readonly errorMessage: string;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* An error thrown when a platform-level WebSocket error
|
|
893
|
+
* occurs. Information provided in this class may be useful
|
|
894
|
+
* for diagnostics purposes but will differ from platform to
|
|
895
|
+
* platform.
|
|
896
|
+
*/
|
|
897
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
898
|
+
export class InternalWebSocketError extends Error {
|
|
899
|
+
private constructor();
|
|
900
|
+
/**
|
|
901
|
+
* @remarks
|
|
902
|
+
* This property can be read in early-execution mode.
|
|
903
|
+
*
|
|
904
|
+
*/
|
|
905
|
+
readonly errorCode: number;
|
|
906
|
+
/**
|
|
907
|
+
* @remarks
|
|
908
|
+
* This property can be read in early-execution mode.
|
|
909
|
+
*
|
|
910
|
+
*/
|
|
911
|
+
readonly errorMessage: string;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* An error thrown when a malformed URI is used.
|
|
916
|
+
*/
|
|
917
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
918
|
+
export class MalformedUriError extends Error {
|
|
919
|
+
private constructor();
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* An error thrown when an network request body exceeds the
|
|
924
|
+
* configured size limit.
|
|
925
|
+
*/
|
|
926
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
927
|
+
export class RequestBodyTooLargeError extends Error {
|
|
928
|
+
private constructor();
|
|
929
|
+
/**
|
|
930
|
+
* @remarks
|
|
931
|
+
* Configured maximum body size in bytes.
|
|
932
|
+
*
|
|
933
|
+
* This property can be read in early-execution mode.
|
|
934
|
+
*
|
|
935
|
+
*/
|
|
936
|
+
readonly maxBytes: number;
|
|
937
|
+
/**
|
|
938
|
+
* @remarks
|
|
939
|
+
* Request body size in bytes.
|
|
940
|
+
*
|
|
941
|
+
* This property can be read in early-execution mode.
|
|
942
|
+
*
|
|
943
|
+
*/
|
|
944
|
+
readonly providedBytes: number;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* An error thrown when secure URI scheme is required but a
|
|
949
|
+
* non-secure URI was provided.
|
|
950
|
+
*/
|
|
951
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
952
|
+
export class TLSOnlyError extends Error {
|
|
953
|
+
private constructor();
|
|
954
|
+
/**
|
|
955
|
+
* @remarks
|
|
956
|
+
* URI that was rejected for not using secure scheme.
|
|
718
957
|
*
|
|
719
958
|
* This property can be read in early-execution mode.
|
|
720
959
|
*
|
|
721
960
|
*/
|
|
722
|
-
|
|
961
|
+
readonly uri: string;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* An error thrown when a network request targets a URI that is
|
|
966
|
+
* not in the configured allow list.
|
|
967
|
+
*/
|
|
968
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
969
|
+
export class UriNotAllowedError extends Error {
|
|
970
|
+
private constructor();
|
|
723
971
|
/**
|
|
724
972
|
* @remarks
|
|
725
|
-
*
|
|
973
|
+
* URI that was rejected because it is not allowed.
|
|
726
974
|
*
|
|
727
975
|
* This property can be read in early-execution mode.
|
|
728
976
|
*
|
|
729
977
|
*/
|
|
730
|
-
|
|
978
|
+
readonly uri: string;
|
|
731
979
|
}
|
|
732
980
|
|
|
733
981
|
/**
|
|
734
|
-
* An error thrown when
|
|
735
|
-
*
|
|
982
|
+
* An error thrown when the connection with the WebSocket
|
|
983
|
+
* server has failed.
|
|
736
984
|
*/
|
|
737
985
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
738
|
-
export class
|
|
986
|
+
export class WebSocketConnectionFailedError extends Error {
|
|
987
|
+
private constructor();
|
|
988
|
+
/**
|
|
989
|
+
* @remarks
|
|
990
|
+
* The error code received when attempting to connect with the
|
|
991
|
+
* server.
|
|
992
|
+
*
|
|
993
|
+
* This property can be read in early-execution mode.
|
|
994
|
+
*
|
|
995
|
+
*/
|
|
996
|
+
readonly errorCode: number;
|
|
997
|
+
/**
|
|
998
|
+
* @remarks
|
|
999
|
+
* The URI provided to make this connection attempt that
|
|
1000
|
+
* failed.
|
|
1001
|
+
*
|
|
1002
|
+
* This property can be read in early-execution mode.
|
|
1003
|
+
*
|
|
1004
|
+
*/
|
|
1005
|
+
readonly uri: string;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* An error that is thrown when the maximum number of connected
|
|
1010
|
+
* WebSockets is reached.
|
|
1011
|
+
*/
|
|
1012
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1013
|
+
export class WebSocketLimitExceededError extends Error {
|
|
1014
|
+
private constructor();
|
|
1015
|
+
/**
|
|
1016
|
+
* @remarks
|
|
1017
|
+
* Number of WebSocket connections already active when
|
|
1018
|
+
* rejected.
|
|
1019
|
+
*
|
|
1020
|
+
* This property can be read in early-execution mode.
|
|
1021
|
+
*
|
|
1022
|
+
*/
|
|
1023
|
+
readonly connectedSockets: number;
|
|
1024
|
+
/**
|
|
1025
|
+
* @remarks
|
|
1026
|
+
* Configured maximum active WebSocket connections.
|
|
1027
|
+
*
|
|
1028
|
+
* This property can be read in early-execution mode.
|
|
1029
|
+
*
|
|
1030
|
+
*/
|
|
1031
|
+
readonly maxConcurrentConnections: number;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* An error thrown when attempting to use a WebSocket while the
|
|
1036
|
+
* socket is not connected to a server.
|
|
1037
|
+
*/
|
|
1038
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1039
|
+
export class WebSocketNotConnectedError extends Error {
|
|
739
1040
|
private constructor();
|
|
740
1041
|
}
|
|
741
1042
|
|
|
742
1043
|
export const beforeEvents: NetworkBeforeEvents;
|
|
743
1044
|
export const http: HttpClient;
|
|
1045
|
+
/**
|
|
1046
|
+
* @remarks
|
|
1047
|
+
* Used to manage WebSocket connections.
|
|
1048
|
+
*
|
|
1049
|
+
*/
|
|
1050
|
+
export const websocket: WebSocket;
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@minecraft/server-net",
|
|
3
|
-
"version": "1.0.0-beta.1.26.
|
|
4
|
-
"description": "",
|
|
5
|
-
"contributors": [
|
|
6
|
-
{
|
|
7
|
-
"name": "Jake Shirley",
|
|
8
|
-
"email": "jake@xbox.com"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"name": "Mike Ammerlaan",
|
|
12
|
-
"email": "mikeam@microsoft.com"
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"peerDependencies": {
|
|
16
|
-
"@minecraft/common": "^1.0.0",
|
|
17
|
-
"@minecraft/server": "^1.17.0 || ^2.0.0",
|
|
18
|
-
"@minecraft/server-admin": "^1.0.0-beta.1.26.
|
|
19
|
-
},
|
|
20
|
-
"license": "MIT"
|
|
1
|
+
{
|
|
2
|
+
"name": "@minecraft/server-net",
|
|
3
|
+
"version": "1.0.0-beta.1.26.20-preview.22",
|
|
4
|
+
"description": "",
|
|
5
|
+
"contributors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Jake Shirley",
|
|
8
|
+
"email": "jake@xbox.com"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "Mike Ammerlaan",
|
|
12
|
+
"email": "mikeam@microsoft.com"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@minecraft/common": "^1.0.0",
|
|
17
|
+
"@minecraft/server": "^1.17.0 || ^2.0.0",
|
|
18
|
+
"@minecraft/server-admin": "^1.0.0-beta.1.26.20-preview.22"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT"
|
|
21
21
|
}
|