@discordeno/gateway 22.0.1-next.2e32899 → 22.0.1-next.2e9b151
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/dist/Shard.d.ts +36 -2
- package/dist/Shard.d.ts.map +1 -1
- package/dist/Shard.js +137 -21
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +40 -23
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +5 -5
package/dist/Shard.d.ts
CHANGED
|
@@ -50,12 +50,19 @@ export declare class DiscordenoShard {
|
|
|
50
50
|
/** zlib inflate/zstd buffer. */
|
|
51
51
|
inflateBuffer: Uint8Array | null;
|
|
52
52
|
/**
|
|
53
|
-
* A function that will be called once the socket is closed and
|
|
53
|
+
* A function that will be called once the socket is closed and the internal states have been updated.
|
|
54
54
|
*
|
|
55
55
|
* @private
|
|
56
56
|
* This is for internal purposes only, and subject to breaking changes.
|
|
57
57
|
*/
|
|
58
|
-
resolveAfterClose?: (
|
|
58
|
+
resolveAfterClose?: () => void;
|
|
59
|
+
/**
|
|
60
|
+
* A function that stops the connection attempts {@link connectWithRetries} is making, if there are any.
|
|
61
|
+
*
|
|
62
|
+
* @private
|
|
63
|
+
* This is for internal purposes only, and subject to breaking changes.
|
|
64
|
+
*/
|
|
65
|
+
cancelConnectRetries?: () => void;
|
|
59
66
|
constructor(options: ShardCreateOptions);
|
|
60
67
|
/** The gateway configuration which is used to connect to Discord. */
|
|
61
68
|
get gatewayConfig(): ShardGatewayConfig;
|
|
@@ -73,6 +80,20 @@ export declare class DiscordenoShard {
|
|
|
73
80
|
* @param bypassRequest - Whether to bypass the requestIdentify handler and identify immediately. This should be used carefully as it can cause invalid sessions.
|
|
74
81
|
*/
|
|
75
82
|
identify(bypassRequest?: boolean): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Connect the shard with the gateway, trying again with an exponential backoff for as long as the opening handshake fails.
|
|
85
|
+
*
|
|
86
|
+
* @param options.waitForTurn - Awaited before every attempt, for example to wait until the shard is allowed to identify.
|
|
87
|
+
* @param options.beforeAttempt - Called right before every attempt, unless the shard has been asked to close while waiting for its turn.
|
|
88
|
+
* @returns Whether the shard is connected. `false` when the shard has been asked to close before an attempt succeeded.
|
|
89
|
+
*
|
|
90
|
+
* @private
|
|
91
|
+
* This is for internal purposes only, and subject to breaking changes.
|
|
92
|
+
*/
|
|
93
|
+
connectWithRetries(options: {
|
|
94
|
+
waitForTurn?: () => Promise<void>;
|
|
95
|
+
beforeAttempt: () => void;
|
|
96
|
+
}): Promise<boolean>;
|
|
76
97
|
/** Check whether the connection to Discord is currently open. */
|
|
77
98
|
isOpen(): boolean;
|
|
78
99
|
/** Attempt to resume the previous shards session with the gateway. */
|
|
@@ -84,6 +105,19 @@ export declare class DiscordenoShard {
|
|
|
84
105
|
send(message: ShardSocketRequest, highPriority?: boolean): Promise<void>;
|
|
85
106
|
/** Shutdown the this. Forcefully disconnect the shard from Discord. The shard may not attempt to reconnect with Discord. */
|
|
86
107
|
shutdown(): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Put the shard offline after its opening handshake failed or was aborted.
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* Runtimes report a socket which never opened differently: Node 22 fires only an error, and a handshake aborted by {@link close} reports a close
|
|
113
|
+
* event first on Node 24. This is therefore called from whichever of the two arrives first, instead of {@link handleClose}. There is no session
|
|
114
|
+
* and no heartbeat to clean up at this point, and no reconnect is attempted here: {@link connect} rejects, and {@link identify} and
|
|
115
|
+
* {@link resume} try again through {@link connectWithRetries}.
|
|
116
|
+
*
|
|
117
|
+
* @private
|
|
118
|
+
* This is for internal purposes only, and subject to breaking changes.
|
|
119
|
+
*/
|
|
120
|
+
handleFailedHandshake(): void;
|
|
87
121
|
/** Handle a gateway connection error */
|
|
88
122
|
handleError(error: Event): void;
|
|
89
123
|
/** Handle a gateway connection close. */
|
package/dist/Shard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shard.d.ts","sourceRoot":"","sources":["../src/Shard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,OAAO,EAAe,KAAK,cAAc,EAA8B,MAAM,WAAW,CAAC;AAC5I,OAAO,KAAK,EAAE,qBAAqB,EAA8B,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAElH,OAAO,EAAS,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAEf,KAAK,kBAAkB,EACvB,UAAU,EAEX,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Shard.d.ts","sourceRoot":"","sources":["../src/Shard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,OAAO,EAAe,KAAK,cAAc,EAA8B,MAAM,WAAW,CAAC;AAC5I,OAAO,KAAK,EAAE,qBAAqB,EAA8B,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAElH,OAAO,EAAS,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAEf,KAAK,kBAAkB,EACvB,UAAU,EAEX,MAAM,YAAY,CAAC;AAOpB,qBAAa,eAAe;IAC1B,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,qFAAqF;IACrF,UAAU,EAAE,kBAAkB,CAAC;IAC/B,kDAAkD;IAClD,KAAK,EAAE,UAAU,CAAC;IAClB,4HAA4H;IAC5H,2BAA2B,EAAE,MAAM,CAAO;IAC1C,4CAA4C;IAC5C,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC7C,8EAA8E;IAC9E,sBAAsB,EAAE,MAAM,CAAS;IACvC,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;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