@api.global/typedsocket 6.1.0 → 6.3.0
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_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.nativebyteerror.d.ts +13 -0
- package/dist_ts/classes.nativebyteerror.js +26 -1
- package/dist_ts/classes.nativebytemanager.d.ts +180 -2
- package/dist_ts/classes.nativebytemanager.js +1400 -52
- package/dist_ts/classes.typedsocket.d.ts +11 -0
- package/dist_ts/classes.typedsocket.js +129 -8
- package/dist_ts/constants.nativemessages.d.ts +45 -0
- package/dist_ts/constants.nativemessages.js +44 -0
- package/dist_ts/helpers.nativemessagecodec.d.ts +6 -0
- package/dist_ts/helpers.nativemessagecodec.js +267 -0
- package/dist_ts/index.d.ts +3 -0
- package/dist_ts/index.js +3 -1
- package/dist_ts/interfaces.diagnostics.d.ts +1 -1
- package/dist_ts/interfaces.nativemessages.d.ts +144 -0
- package/dist_ts/interfaces.nativemessages.js +2 -0
- package/package.json +3 -3
- package/readme.hints.md +14 -5
- package/readme.md +142 -9
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@api.global/typedsocket',
|
|
6
|
-
version: '6.
|
|
6
|
+
version: '6.3.0',
|
|
7
7
|
description: 'A library for creating typed WebSocket connections, supporting bi-directional communication with type safety.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx5QkFBeUI7SUFDL0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLCtHQUErRztDQUM3SCxDQUFBIn0=
|
|
@@ -11,3 +11,16 @@ export declare class NativeByteCapabilityError extends NativeByteError {
|
|
|
11
11
|
export declare class NativeByteStreamClosedError extends NativeByteError {
|
|
12
12
|
constructor(messageArg?: string, optionsArg?: ErrorOptions);
|
|
13
13
|
}
|
|
14
|
+
export declare class NativeMessageError extends Error {
|
|
15
|
+
readonly code: string;
|
|
16
|
+
constructor(messageArg: string, code: string, optionsArg?: ErrorOptions);
|
|
17
|
+
}
|
|
18
|
+
export declare class NativeMessageProtocolError extends NativeMessageError {
|
|
19
|
+
constructor(messageArg: string, optionsArg?: ErrorOptions);
|
|
20
|
+
}
|
|
21
|
+
export declare class NativeMessageCapabilityError extends NativeMessageError {
|
|
22
|
+
constructor(messageArg?: string, optionsArg?: ErrorOptions);
|
|
23
|
+
}
|
|
24
|
+
export declare class NativeMessageChannelClosedError extends NativeMessageError {
|
|
25
|
+
constructor(messageArg?: string, optionsArg?: ErrorOptions);
|
|
26
|
+
}
|
|
@@ -23,4 +23,29 @@ export class NativeByteStreamClosedError extends NativeByteError {
|
|
|
23
23
|
this.name = 'NativeByteStreamClosedError';
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
export class NativeMessageError extends Error {
|
|
27
|
+
constructor(messageArg, code, optionsArg) {
|
|
28
|
+
super(messageArg, optionsArg);
|
|
29
|
+
this.code = code;
|
|
30
|
+
this.name = 'NativeMessageError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export class NativeMessageProtocolError extends NativeMessageError {
|
|
34
|
+
constructor(messageArg, optionsArg) {
|
|
35
|
+
super(messageArg, 'NATIVE_MESSAGE_PROTOCOL_ERROR', optionsArg);
|
|
36
|
+
this.name = 'NativeMessageProtocolError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class NativeMessageCapabilityError extends NativeMessageError {
|
|
40
|
+
constructor(messageArg = 'native-message-v1 is unavailable', optionsArg) {
|
|
41
|
+
super(messageArg, 'NATIVE_MESSAGE_CAPABILITY_UNAVAILABLE', optionsArg);
|
|
42
|
+
this.name = 'NativeMessageCapabilityError';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class NativeMessageChannelClosedError extends NativeMessageError {
|
|
46
|
+
constructor(messageArg = 'Native message channel is closed', optionsArg) {
|
|
47
|
+
super(messageArg, 'NATIVE_MESSAGE_CHANNEL_CLOSED', optionsArg);
|
|
48
|
+
this.name = 'NativeMessageChannelClosedError';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5uYXRpdmVieXRlZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jbGFzc2VzLm5hdGl2ZWJ5dGVlcnJvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLE9BQU8sZUFBZ0IsU0FBUSxLQUFLO0lBQ3hDLFlBQ0UsVUFBa0IsRUFDRixJQUFZLEVBQzVCLFVBQXlCO1FBRXpCLEtBQUssQ0FBQyxVQUFVLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFIZCxTQUFJLEdBQUosSUFBSSxDQUFRO1FBSTVCLElBQUksQ0FBQyxJQUFJLEdBQUcsaUJBQWlCLENBQUM7SUFDaEMsQ0FBQztDQUNGO0FBRUQsTUFBTSxPQUFPLHVCQUF3QixTQUFRLGVBQWU7SUFDMUQsWUFBWSxVQUFrQixFQUFFLFVBQXlCO1FBQ3ZELEtBQUssQ0FBQyxVQUFVLEVBQUUsNEJBQTRCLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFDNUQsSUFBSSxDQUFDLElBQUksR0FBRyx5QkFBeUIsQ0FBQztJQUN4QyxDQUFDO0NBQ0Y7QUFFRCxNQUFNLE9BQU8seUJBQTBCLFNBQVEsZUFBZTtJQUM1RCxZQUFZLFVBQVUsR0FBRywrQkFBK0IsRUFBRSxVQUF5QjtRQUNqRixLQUFLLENBQUMsVUFBVSxFQUFFLG9DQUFvQyxFQUFFLFVBQVUsQ0FBQyxDQUFDO1FBQ3BFLElBQUksQ0FBQyxJQUFJLEdBQUcsMkJBQTJCLENBQUM7SUFDMUMsQ0FBQztDQUNGO0FBRUQsTUFBTSxPQUFPLDJCQUE0QixTQUFRLGVBQWU7SUFDOUQsWUFBWSxVQUFVLEdBQUcsOEJBQThCLEVBQUUsVUFBeUI7UUFDaEYsS0FBSyxDQUFDLFVBQVUsRUFBRSwyQkFBMkIsRUFBRSxVQUFVLENBQUMsQ0FBQztRQUMzRCxJQUFJLENBQUMsSUFBSSxHQUFHLDZCQUE2QixDQUFDO0lBQzVDLENBQUM7Q0FDRjtBQUVELE1BQU0sT0FBTyxrQkFBbUIsU0FBUSxLQUFLO0lBQzNDLFlBQ0UsVUFBa0IsRUFDRixJQUFZLEVBQzVCLFVBQXlCO1FBRXpCLEtBQUssQ0FBQyxVQUFVLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFIZCxTQUFJLEdBQUosSUFBSSxDQUFRO1FBSTVCLElBQUksQ0FBQyxJQUFJLEdBQUcsb0JBQW9CLENBQUM7SUFDbkMsQ0FBQztDQUNGO0FBRUQsTUFBTSxPQUFPLDBCQUEyQixTQUFRLGtCQUFrQjtJQUNoRSxZQUFZLFVBQWtCLEVBQUUsVUFBeUI7UUFDdkQsS0FBSyxDQUFDLFVBQVUsRUFBRSwrQkFBK0IsRUFBRSxVQUFVLENBQUMsQ0FBQztRQUMvRCxJQUFJLENBQUMsSUFBSSxHQUFHLDRCQUE0QixDQUFDO0lBQzNDLENBQUM7Q0FDRjtBQUVELE1BQU0sT0FBTyw0QkFBNkIsU0FBUSxrQkFBa0I7SUFDbEUsWUFBWSxVQUFVLEdBQUcsa0NBQWtDLEVBQUUsVUFBeUI7UUFDcEYsS0FBSyxDQUFDLFVBQVUsRUFBRSx1Q0FBdUMsRUFBRSxVQUFVLENBQUMsQ0FBQztRQUN2RSxJQUFJLENBQUMsSUFBSSxHQUFHLDhCQUE4QixDQUFDO0lBQzdDLENBQUM7Q0FDRjtBQUVELE1BQU0sT0FBTywrQkFBZ0MsU0FBUSxrQkFBa0I7SUFDckUsWUFBWSxVQUFVLEdBQUcsa0NBQWtDLEVBQUUsVUFBeUI7UUFDcEYsS0FBSyxDQUFDLFVBQVUsRUFBRSwrQkFBK0IsRUFBRSxVQUFVLENBQUMsQ0FBQztRQUMvRCxJQUFJLENBQUMsSUFBSSxHQUFHLGlDQUFpQyxDQUFDO0lBQ2hELENBQUM7Q0FDRiJ9
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
|
-
import { NativeByteStreamClosedError } from './classes.nativebyteerror.js';
|
|
2
|
+
import { NativeByteStreamClosedError, NativeMessageChannelClosedError } from './classes.nativebyteerror.js';
|
|
3
3
|
import type { INativeByteCapabilityStatus, INativeByteCreateReceiveGrantOptions, INativeByteDescriptor, INativeByteOpenSenderOptions, INativeByteReceipt, INativeByteReceiveGrant, INativeByteRuntime, INativeByteStats, TNativeByteCapabilityMode, TNativeByteConnectionBinding, TNativeByteRevalidate } from './interfaces.nativebytes.js';
|
|
4
|
+
import type { INativeMessageCapabilityStatus, INativeMessageCreateReceiveGrantOptions, INativeMessageDescriptor, INativeMessageOpenSenderOptions, INativeMessageReceiveGrant, INativeMessageReceiver, INativeMessageSender, INativeMessageStats, TNativeMessageCapabilityMode, TNativeMessageRevalidate } from './interfaces.nativemessages.js';
|
|
4
5
|
import type { TNativeByteDiagnosticEvent } from './interfaces.diagnostics.js';
|
|
5
6
|
type TNativeStreamTransport = plugins.typedrequestInterfaces.INativeStreamTransport;
|
|
6
7
|
type TNativeStreamEndpoint = plugins.typedrequestInterfaces.INativeStreamTransportEndpoint;
|
|
@@ -14,12 +15,28 @@ interface IDeferred<T> {
|
|
|
14
15
|
interface IOutboundFrame {
|
|
15
16
|
readonly bytes: Uint8Array<ArrayBuffer>;
|
|
16
17
|
readonly streamId: string;
|
|
18
|
+
readonly protocol: 'nativeByte' | 'nativeMessage';
|
|
17
19
|
readonly producer?: IProducerState;
|
|
18
20
|
readonly payloadBytes: number;
|
|
19
21
|
readonly settlement: IDeferred<void>;
|
|
20
22
|
accountingReleased: boolean;
|
|
21
23
|
timer?: unknown;
|
|
22
24
|
}
|
|
25
|
+
interface INativeMessageCompleted {
|
|
26
|
+
readonly sequence: number;
|
|
27
|
+
readonly payload: Uint8Array<ArrayBuffer>;
|
|
28
|
+
}
|
|
29
|
+
interface INativeMessageReassembly {
|
|
30
|
+
readonly sequence: number;
|
|
31
|
+
readonly totalLength: number;
|
|
32
|
+
readonly payload: Uint8Array<ArrayBuffer>;
|
|
33
|
+
nextOffset: number;
|
|
34
|
+
}
|
|
35
|
+
interface INativeMessageTombstone {
|
|
36
|
+
readonly channelId: string;
|
|
37
|
+
readonly expiresAt: number;
|
|
38
|
+
readonly retainedBytes: number;
|
|
39
|
+
}
|
|
23
40
|
interface IProducerAdmission {
|
|
24
41
|
readonly payload: Uint8Array;
|
|
25
42
|
remainingPayloadBytes: number;
|
|
@@ -106,12 +123,71 @@ interface IProducerState {
|
|
|
106
123
|
closeError?: NativeByteStreamClosedError;
|
|
107
124
|
}
|
|
108
125
|
type TStreamState = IConsumerState | IProducerState;
|
|
126
|
+
type TNativeMessageReceiverStatus = 'grant' | 'validating-open' | 'open' | 'closing' | 'closed';
|
|
127
|
+
type TNativeMessageSenderStatus = 'opening' | 'open' | 'closing' | 'closed';
|
|
128
|
+
interface INativeMessageReceiverState {
|
|
129
|
+
readonly role: 'messageReceiver';
|
|
130
|
+
readonly connection: IConnectionState;
|
|
131
|
+
readonly descriptor: INativeMessageDescriptor;
|
|
132
|
+
readonly revalidate: TNativeMessageRevalidate;
|
|
133
|
+
readonly principalId: string;
|
|
134
|
+
readonly revisions: {
|
|
135
|
+
readonly credentialRevision: string;
|
|
136
|
+
readonly configRevision: string;
|
|
137
|
+
readonly bindingRevision: string;
|
|
138
|
+
};
|
|
139
|
+
readonly authorityMetadataBytes: number;
|
|
140
|
+
readonly endpoint: NativeMessageReceiver;
|
|
141
|
+
readonly opened: IDeferred<NativeMessageReceiver>;
|
|
142
|
+
readonly completion: IDeferred<void>;
|
|
143
|
+
readonly closedSignal: IDeferred<never>;
|
|
144
|
+
readonly receiveWaiters: Set<IDeferred<void>>;
|
|
145
|
+
readonly revalidationControllers: Set<AbortController>;
|
|
146
|
+
status: TNativeMessageReceiverStatus;
|
|
147
|
+
receiveActive: boolean;
|
|
148
|
+
nextSequence: number;
|
|
149
|
+
acceptedMaxMessageBytes: number;
|
|
150
|
+
reassembly?: INativeMessageReassembly;
|
|
151
|
+
completed?: INativeMessageCompleted;
|
|
152
|
+
remoteClosed: boolean;
|
|
153
|
+
timer?: unknown;
|
|
154
|
+
closeError?: NativeMessageChannelClosedError;
|
|
155
|
+
}
|
|
156
|
+
interface INativeMessageSenderState {
|
|
157
|
+
readonly role: 'messageSender';
|
|
158
|
+
readonly connection: IConnectionState;
|
|
159
|
+
readonly descriptor: INativeMessageDescriptor;
|
|
160
|
+
readonly endpoint: NativeMessageSender;
|
|
161
|
+
readonly opened: IDeferred<NativeMessageSender>;
|
|
162
|
+
readonly completion: IDeferred<void>;
|
|
163
|
+
readonly closedSignal: IDeferred<never>;
|
|
164
|
+
status: TNativeMessageSenderStatus;
|
|
165
|
+
acceptedMaxMessageBytes: number;
|
|
166
|
+
operationTail: Promise<void>;
|
|
167
|
+
nextSequence: number;
|
|
168
|
+
pendingMessages: number;
|
|
169
|
+
pendingMessageBytes: number;
|
|
170
|
+
terminalRequested: boolean;
|
|
171
|
+
closePromise?: Promise<void>;
|
|
172
|
+
awaitingAck?: {
|
|
173
|
+
readonly sequence: number;
|
|
174
|
+
readonly deferred: IDeferred<void>;
|
|
175
|
+
};
|
|
176
|
+
openTimer?: unknown;
|
|
177
|
+
progressTimer?: unknown;
|
|
178
|
+
closeTimer?: unknown;
|
|
179
|
+
closeError?: NativeMessageChannelClosedError;
|
|
180
|
+
}
|
|
181
|
+
type TNativeMessageChannelState = INativeMessageReceiverState | INativeMessageSenderState;
|
|
109
182
|
interface IConnectionState {
|
|
110
183
|
readonly binding: TNativeByteConnectionBinding;
|
|
111
184
|
readonly transport: NativeByteConnectionTransport;
|
|
112
185
|
readonly grants: Map<string, IConsumerState>;
|
|
113
186
|
readonly streams: Map<string, TStreamState>;
|
|
114
187
|
readonly tombstones: Map<string, ITombstone>;
|
|
188
|
+
readonly messageGrants: Map<string, INativeMessageReceiverState>;
|
|
189
|
+
readonly messageChannels: Map<string, TNativeMessageChannelState>;
|
|
190
|
+
readonly messageTombstones: Map<string, INativeMessageTombstone>;
|
|
115
191
|
readonly rawQueue: Uint8Array[];
|
|
116
192
|
readonly controlQueue: IOutboundFrame[];
|
|
117
193
|
readonly dataQueue: IOutboundFrame[];
|
|
@@ -122,11 +198,14 @@ interface IConnectionState {
|
|
|
122
198
|
readonly revalidationControllers: Set<AbortController>;
|
|
123
199
|
negotiated: boolean;
|
|
124
200
|
nativeEnabled: boolean;
|
|
201
|
+
messageNegotiated: boolean;
|
|
202
|
+
nativeMessageEnabled: boolean;
|
|
125
203
|
closed: boolean;
|
|
126
204
|
processingRaw: boolean;
|
|
127
205
|
rawQueueBytes: number;
|
|
128
206
|
processingRawBytes: number;
|
|
129
207
|
queuedPayloadBytes: number;
|
|
208
|
+
nativeMessageQueuedPayloadBytes: number;
|
|
130
209
|
authorityMetadataBytes: number;
|
|
131
210
|
tombstoneBytes: number;
|
|
132
211
|
receiveWindowReservedBytes: number;
|
|
@@ -136,6 +215,7 @@ interface IConnectionState {
|
|
|
136
215
|
clientTurnScheduled: boolean;
|
|
137
216
|
clientBackpressureTimer?: unknown;
|
|
138
217
|
negotiationTimer?: unknown;
|
|
218
|
+
nativeMessageNegotiationTimer?: unknown;
|
|
139
219
|
}
|
|
140
220
|
export declare class NativeByteReceiver implements TNativeStreamEndpoint {
|
|
141
221
|
private readonly manager;
|
|
@@ -175,6 +255,35 @@ export declare class NativeByteSender implements TNativeStreamEndpoint {
|
|
|
175
255
|
close(_sendClosingBitArg?: boolean): Promise<void>;
|
|
176
256
|
abort(reasonArg?: unknown): Promise<void>;
|
|
177
257
|
}
|
|
258
|
+
export declare class NativeMessageReceiver implements INativeMessageReceiver {
|
|
259
|
+
private readonly manager;
|
|
260
|
+
private readonly state;
|
|
261
|
+
constructor(manager: NativeByteManager, state: INativeMessageReceiverState);
|
|
262
|
+
get closed(): Promise<void>;
|
|
263
|
+
receive(): Promise<Uint8Array | undefined>;
|
|
264
|
+
reject(reasonArg?: unknown): Promise<void>;
|
|
265
|
+
}
|
|
266
|
+
export declare class NativeMessageSender implements INativeMessageSender {
|
|
267
|
+
private readonly manager;
|
|
268
|
+
private readonly state;
|
|
269
|
+
constructor(manager: NativeByteManager, state: INativeMessageSenderState);
|
|
270
|
+
get closed(): Promise<void>;
|
|
271
|
+
send(messageArg: Uint8Array): Promise<void>;
|
|
272
|
+
close(): Promise<void>;
|
|
273
|
+
}
|
|
274
|
+
export declare class NativeMessageFacade {
|
|
275
|
+
#private;
|
|
276
|
+
constructor(managerArg: NativeByteManager);
|
|
277
|
+
createReceiveGrant(optionsArg: INativeMessageCreateReceiveGrantOptions): INativeMessageReceiveGrant;
|
|
278
|
+
openSender(descriptorArg: INativeMessageDescriptor, optionsArg?: INativeMessageOpenSenderOptions): Promise<INativeMessageSender>;
|
|
279
|
+
getCapability(targetArg?: {
|
|
280
|
+
readonly peer: plugins.IWebSocketPeer;
|
|
281
|
+
} | plugins.IWebSocketPeer): INativeMessageCapabilityStatus;
|
|
282
|
+
getStats(targetArg?: {
|
|
283
|
+
readonly peer: plugins.IWebSocketPeer;
|
|
284
|
+
} | plugins.IWebSocketPeer): INativeMessageStats;
|
|
285
|
+
normalizeMaxMessageBytes(valueArg: unknown): number;
|
|
286
|
+
}
|
|
178
287
|
declare class NativeByteConnectionTransport implements TNativeStreamTransport {
|
|
179
288
|
private readonly manager;
|
|
180
289
|
private readonly connection;
|
|
@@ -187,14 +296,17 @@ declare class NativeByteConnectionTransport implements TNativeStreamTransport {
|
|
|
187
296
|
export interface INativeByteManagerOptions {
|
|
188
297
|
readonly side: 'client' | 'server';
|
|
189
298
|
readonly capabilityMode?: TNativeByteCapabilityMode;
|
|
299
|
+
readonly nativeMessageCapabilityMode?: TNativeMessageCapabilityMode;
|
|
190
300
|
readonly runtime?: INativeByteRuntime;
|
|
191
301
|
/** Structured close/rejection diagnostics; must not throw, errors are swallowed. */
|
|
192
302
|
readonly onDiagnostic?: (eventArg: TNativeByteDiagnosticEvent) => void;
|
|
193
303
|
}
|
|
194
304
|
export declare class NativeByteManager {
|
|
195
305
|
readonly webSocketTransportOwner: plugins.IWebSocketTransportOwner;
|
|
306
|
+
readonly messages: NativeMessageFacade;
|
|
196
307
|
private readonly side;
|
|
197
308
|
private readonly capabilityMode;
|
|
309
|
+
private readonly nativeMessageCapabilityMode;
|
|
198
310
|
private readonly runtime;
|
|
199
311
|
private readonly onDiagnostic?;
|
|
200
312
|
private readonly clientNativeStreamTransport;
|
|
@@ -229,6 +341,25 @@ export declare class NativeByteManager {
|
|
|
229
341
|
capabilities: readonly ['native-byte-v1'] | readonly [];
|
|
230
342
|
required: boolean;
|
|
231
343
|
};
|
|
344
|
+
getClientNativeMessageNegotiationAdvertisement(): {
|
|
345
|
+
protocolMajor: 1;
|
|
346
|
+
capabilities: readonly ['native-message-v1'] | readonly [];
|
|
347
|
+
};
|
|
348
|
+
completeClientNativeMessageNegotiation(webSocketArg: WebSocket, generationArg: number, responseArg: {
|
|
349
|
+
protocolMajor: number;
|
|
350
|
+
capabilities: readonly string[];
|
|
351
|
+
required?: boolean;
|
|
352
|
+
}): void;
|
|
353
|
+
failOptionalClientNativeMessageNegotiation(webSocketArg: WebSocket, generationArg: number): void;
|
|
354
|
+
negotiateServerNativeMessages(peerArg: plugins.IWebSocketPeer, requestArg: {
|
|
355
|
+
protocolMajor: number;
|
|
356
|
+
capabilities: readonly string[];
|
|
357
|
+
}): {
|
|
358
|
+
protocolMajor: 1;
|
|
359
|
+
capabilities: readonly ['native-message-v1'] | readonly [];
|
|
360
|
+
required: boolean;
|
|
361
|
+
};
|
|
362
|
+
connectionHasNativeMessageCapability(connectionArg: IConnectionState): boolean;
|
|
232
363
|
getClientNativeStreamTransport(): TNativeStreamTransport | undefined;
|
|
233
364
|
getServerNativeStreamTransport(peerArg: plugins.IWebSocketPeer): TNativeStreamTransport | undefined;
|
|
234
365
|
connectionHasCapability(connectionArg: IConnectionState): boolean;
|
|
@@ -242,6 +373,14 @@ export declare class NativeByteManager {
|
|
|
242
373
|
getStats(targetArg?: {
|
|
243
374
|
readonly peer: plugins.IWebSocketPeer;
|
|
244
375
|
} | plugins.IWebSocketPeer): INativeByteStats;
|
|
376
|
+
createNativeMessageReceiveGrant(optionsArg: INativeMessageCreateReceiveGrantOptions): INativeMessageReceiveGrant;
|
|
377
|
+
openNativeMessageSender(descriptorArg: INativeMessageDescriptor, optionsArg?: INativeMessageOpenSenderOptions): Promise<NativeMessageSender>;
|
|
378
|
+
getNativeMessageCapability(targetArg?: {
|
|
379
|
+
readonly peer: plugins.IWebSocketPeer;
|
|
380
|
+
} | plugins.IWebSocketPeer): INativeMessageCapabilityStatus;
|
|
381
|
+
getNativeMessageStats(targetArg?: {
|
|
382
|
+
readonly peer: plugins.IWebSocketPeer;
|
|
383
|
+
} | plugins.IWebSocketPeer): INativeMessageStats;
|
|
245
384
|
registerGenericNativeStream(connectionArg: IConnectionState): plugins.typedrequestInterfaces.INativeStreamTransportRegistration;
|
|
246
385
|
openSenderOnConnection(connectionArg: IConnectionState, descriptorArg: plugins.typedrequestInterfaces.TNativeStreamDescriptor): Promise<NativeByteSender>;
|
|
247
386
|
enqueueProducerData(stateArg: IProducerState, dataArg: Uint8Array): Promise<void>;
|
|
@@ -251,6 +390,16 @@ export declare class NativeByteManager {
|
|
|
251
390
|
sendProducerData(stateArg: IProducerState, admissionArg: IProducerAdmission): Promise<void>;
|
|
252
391
|
finishProducer(stateArg: IProducerState): Promise<void>;
|
|
253
392
|
abortProducer(stateArg: IProducerState, reasonArg?: unknown): Promise<void>;
|
|
393
|
+
sendNativeMessage(stateArg: INativeMessageSenderState, messageArg: Uint8Array): Promise<void>;
|
|
394
|
+
private admitNativeMessage;
|
|
395
|
+
private sendNativeMessageAdmission;
|
|
396
|
+
private releaseNativeMessageAdmission;
|
|
397
|
+
closeNativeMessageSender(stateArg: INativeMessageSenderState): Promise<void>;
|
|
398
|
+
private finishNativeMessageSender;
|
|
399
|
+
receiveNativeMessage(stateArg: INativeMessageReceiverState): Promise<Uint8Array | undefined>;
|
|
400
|
+
rejectNativeMessageReceiver(stateArg: INativeMessageReceiverState, reasonArg?: unknown): Promise<void>;
|
|
401
|
+
private refreshNativeMessageSenderProgressTimer;
|
|
402
|
+
private refreshNativeMessageReceiverProgressTimer;
|
|
254
403
|
private getConsumerQueueLength;
|
|
255
404
|
consumeReceiverData(stateArg: IConsumerState): Promise<Uint8Array | undefined>;
|
|
256
405
|
private consumeReceiverDataOnce;
|
|
@@ -266,6 +415,14 @@ export declare class NativeByteManager {
|
|
|
266
415
|
private enqueueRawFrame;
|
|
267
416
|
private processRawQueue;
|
|
268
417
|
private handleFrame;
|
|
418
|
+
private handleNativeMessageFrame;
|
|
419
|
+
private handleNativeMessageOpen;
|
|
420
|
+
private handleNativeMessageOpenAck;
|
|
421
|
+
private handleNativeMessageFragment;
|
|
422
|
+
private handleNativeMessageAck;
|
|
423
|
+
private handleNativeMessageClose;
|
|
424
|
+
private handleNativeMessageCloseAck;
|
|
425
|
+
private handleNativeMessageReset;
|
|
269
426
|
private handleOpen;
|
|
270
427
|
private handleOpenAck;
|
|
271
428
|
private handleData;
|
|
@@ -275,6 +432,10 @@ export declare class NativeByteManager {
|
|
|
275
432
|
private handleReset;
|
|
276
433
|
private createReceiveGrantOnConnection;
|
|
277
434
|
private validateDescriptor;
|
|
435
|
+
private validateNativeMessageDescriptor;
|
|
436
|
+
private resolveNativeMessageConnection;
|
|
437
|
+
private requireNativeMessageCapability;
|
|
438
|
+
private reserveNativeMessageChannelSlot;
|
|
278
439
|
private resolveConnection;
|
|
279
440
|
private resolveConnectionForInspection;
|
|
280
441
|
private requireConnectionCapability;
|
|
@@ -282,12 +443,27 @@ export declare class NativeByteManager {
|
|
|
282
443
|
private normalizePrincipalId;
|
|
283
444
|
private normalizeAuthorityRevision;
|
|
284
445
|
private getServerConnectionCount;
|
|
285
|
-
private
|
|
446
|
+
private getServerNativeByteStreamCount;
|
|
447
|
+
private getServerAggregateSlotCount;
|
|
286
448
|
private getServerRetainedBytes;
|
|
287
449
|
private getServerReceiveReservationBytes;
|
|
288
450
|
private assertServerRetainedByteCapacity;
|
|
289
451
|
private assertServerReceiveReservationCapacity;
|
|
290
452
|
private maybeReleaseServerAccountingConnection;
|
|
453
|
+
private revalidateNativeMessageReceiver;
|
|
454
|
+
private getNativeMessageRevalidationResetCode;
|
|
455
|
+
private assertNativeMessageReceiverOwned;
|
|
456
|
+
private assertNativeMessageSenderOpen;
|
|
457
|
+
private wakeNativeMessageReceiveWaiters;
|
|
458
|
+
private failNativeMessageChannelProtocol;
|
|
459
|
+
private failNativeMessageSender;
|
|
460
|
+
private failNativeMessageReceiver;
|
|
461
|
+
private cleanupNativeMessageSender;
|
|
462
|
+
private cleanupNativeMessageReceiver;
|
|
463
|
+
private tryAddNativeMessageTombstone;
|
|
464
|
+
private addNativeMessageTombstone;
|
|
465
|
+
private pruneNativeMessageTombstones;
|
|
466
|
+
private deleteNativeMessageTombstone;
|
|
291
467
|
private revalidateConsumer;
|
|
292
468
|
private getRevalidationResetCode;
|
|
293
469
|
private assertConsumerOwned;
|
|
@@ -310,6 +486,8 @@ export declare class NativeByteManager {
|
|
|
310
486
|
private pruneTombstones;
|
|
311
487
|
private deleteTombstone;
|
|
312
488
|
private sendReset;
|
|
489
|
+
private sendNativeMessageReset;
|
|
490
|
+
private enqueueNativeMessageFrame;
|
|
313
491
|
private enqueueFrame;
|
|
314
492
|
private enqueueEncodedFrame;
|
|
315
493
|
private wakeOutbound;
|