@ikonai/sdk 1.0.23 → 1.0.26
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/assets/{protocol-worker-ZToAZg1T.js → protocol-worker-Cj8zX_U0.js} +2 -2
- package/client/endpoint-selector.d.ts +19 -4
- package/client/ikon-client-config.d.ts +10 -2
- package/client/ikon-client.d.ts +13 -0
- package/connection/authenticator.d.ts +4 -2
- package/connection/urls.d.ts +5 -0
- package/index.d.ts +1 -1
- package/index.js +1729 -1662
- package/package.json +1 -1
- package/webrtc/webrtc-config.d.ts +2 -1
- package/webrtc/webrtc-signaling.d.ts +2 -4
|
@@ -897,7 +897,7 @@ class yt {
|
|
|
897
897
|
* Handle connection close.
|
|
898
898
|
*/
|
|
899
899
|
handleClose(e, r) {
|
|
900
|
-
this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(e, r,
|
|
900
|
+
this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(e, r, !1);
|
|
901
901
|
}
|
|
902
902
|
/**
|
|
903
903
|
* Reset the keepalive timeout.
|
|
@@ -1208,7 +1208,7 @@ class St {
|
|
|
1208
1208
|
*/
|
|
1209
1209
|
handleChannelClose(e, r, s, n) {
|
|
1210
1210
|
if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline")) {
|
|
1211
|
-
if (
|
|
1211
|
+
if (n) {
|
|
1212
1212
|
I.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
|
|
1213
1213
|
return;
|
|
1214
1214
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Entrypoint, EntrypointType } from '../../../../shared/protocol/src/index.ts';
|
|
2
2
|
import { LocalConfig } from './ikon-client-config';
|
|
3
|
+
/**
|
|
4
|
+
* Proxy connection mode.
|
|
5
|
+
* - `force-proxy`: only try proxy URLs/transports (e.g. `?proxy=true`)
|
|
6
|
+
* - `force-direct`: only try direct URLs/transports (e.g. `?proxy=false`)
|
|
7
|
+
* - `auto`: try both, ordered by preference, with persistent learning
|
|
8
|
+
*/
|
|
9
|
+
export type ProxyMode = 'force-proxy' | 'force-direct' | 'auto';
|
|
3
10
|
/**
|
|
4
11
|
* EndpointSelector handles ordering and selection of endpoint types.
|
|
5
12
|
*
|
|
@@ -9,10 +16,20 @@ import { LocalConfig } from './ikon-client-config';
|
|
|
9
16
|
*/
|
|
10
17
|
export declare class EndpointSelector {
|
|
11
18
|
private readonly isLocal;
|
|
19
|
+
private readonly _proxyMode;
|
|
20
|
+
private _proxyPreferred;
|
|
12
21
|
private workingEndpointType;
|
|
13
22
|
constructor(config: {
|
|
14
23
|
local?: LocalConfig;
|
|
24
|
+
proxyMode?: ProxyMode;
|
|
15
25
|
});
|
|
26
|
+
get proxyMode(): ProxyMode;
|
|
27
|
+
get proxyPreferred(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Mark proxy as preferred and persist to localStorage.
|
|
30
|
+
* Called by IkonClient when auth-level proxy fallback succeeds in auto mode.
|
|
31
|
+
*/
|
|
32
|
+
markProxyPreferred(): void;
|
|
16
33
|
/**
|
|
17
34
|
* Get ordered list of endpoint types to try.
|
|
18
35
|
* Returns only types that exist in the provided map.
|
|
@@ -20,15 +37,13 @@ export declare class EndpointSelector {
|
|
|
20
37
|
getOrderedTypes(byType: Map<EntrypointType, Entrypoint[]>): EntrypointType[];
|
|
21
38
|
/**
|
|
22
39
|
* Remember the working endpoint type for future connections.
|
|
23
|
-
*
|
|
40
|
+
* In force modes, skip all localStorage persistence.
|
|
24
41
|
*/
|
|
25
42
|
rememberWorkingType(type: EntrypointType): void;
|
|
26
43
|
/**
|
|
27
44
|
* Clear the remembered endpoint type.
|
|
28
45
|
*/
|
|
29
46
|
clearRememberedType(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Load remembered type from localStorage.
|
|
32
|
-
*/
|
|
33
47
|
private loadRememberedType;
|
|
48
|
+
private loadProxyPreference;
|
|
34
49
|
}
|
|
@@ -202,11 +202,15 @@ export interface MediaSessionConfig {
|
|
|
202
202
|
/**
|
|
203
203
|
* Audio playback pipeline configuration.
|
|
204
204
|
*
|
|
205
|
-
* Audio is
|
|
205
|
+
* Audio is enabled by default. The SDK prepares the audio pipeline and starts
|
|
206
206
|
* decoding as soon as possible. Audio output still depends on browser autoplay policies.
|
|
207
207
|
* The SDK automatically resumes the AudioContext on the first user gesture (click, touch, keypress, etc.).
|
|
208
208
|
*/
|
|
209
209
|
export interface AudioConfig {
|
|
210
|
+
/**
|
|
211
|
+
* Enable audio playback pipeline. Default: true
|
|
212
|
+
*/
|
|
213
|
+
enabled?: boolean;
|
|
210
214
|
/**
|
|
211
215
|
* Performance preferences for audio processing.
|
|
212
216
|
*/
|
|
@@ -223,10 +227,14 @@ export interface AudioConfig {
|
|
|
223
227
|
/**
|
|
224
228
|
* Video playback pipeline configuration.
|
|
225
229
|
*
|
|
226
|
-
* Video is
|
|
230
|
+
* Video is enabled by default. Video rendering requires an explicit surface (canvas)
|
|
227
231
|
* provided by the app. The SDK prepares worker/decoder plumbing to reduce time-to-first-frame.
|
|
228
232
|
*/
|
|
229
233
|
export interface VideoConfig {
|
|
234
|
+
/**
|
|
235
|
+
* Enable video playback pipeline. Default: true
|
|
236
|
+
*/
|
|
237
|
+
enabled?: boolean;
|
|
230
238
|
performance?: IkonVideoPlaybackConfig['performance'];
|
|
231
239
|
}
|
|
232
240
|
/**
|
package/client/ikon-client.d.ts
CHANGED
|
@@ -119,10 +119,13 @@ export declare class IkonClient {
|
|
|
119
119
|
private unregisterSoundFunctions;
|
|
120
120
|
private nextProtocolPortId;
|
|
121
121
|
private nextProtocolSendPortId;
|
|
122
|
+
private readonly _audioEnabled;
|
|
123
|
+
private readonly _videoEnabled;
|
|
122
124
|
private readonly _media;
|
|
123
125
|
private _mediaCapture;
|
|
124
126
|
private _webRtcSignaling;
|
|
125
127
|
private _webRtcAudioElements;
|
|
128
|
+
private _webRtcAudioStreams;
|
|
126
129
|
private _webRtcVideoStreams;
|
|
127
130
|
private _webRtcTrackMap;
|
|
128
131
|
private _waitForExternalConnectUrl;
|
|
@@ -140,8 +143,17 @@ export declare class IkonClient {
|
|
|
140
143
|
* These are only available in browser environments.
|
|
141
144
|
*/
|
|
142
145
|
get mediaCapture(): IkonMediaCapture | null;
|
|
146
|
+
/**
|
|
147
|
+
* Whether audio playback is enabled.
|
|
148
|
+
*/
|
|
149
|
+
get isAudioEnabled(): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Whether video playback is enabled.
|
|
152
|
+
*/
|
|
153
|
+
get isVideoEnabled(): boolean;
|
|
143
154
|
/**
|
|
144
155
|
* Whether WebRTC is enabled for audio/video transport.
|
|
156
|
+
* Returns false if both audio and video are disabled, even if webRtc.enabled is true.
|
|
145
157
|
*/
|
|
146
158
|
get isWebRtcEnabled(): boolean;
|
|
147
159
|
/**
|
|
@@ -290,6 +302,7 @@ export declare class IkonClient {
|
|
|
290
302
|
private _webRtcAudioUnlockHandler;
|
|
291
303
|
private readonly _webRtcMediaSession;
|
|
292
304
|
private playWebRtcAudioTrack;
|
|
305
|
+
private stopWebRtcAudioTrack;
|
|
293
306
|
private setupWebRtcMediaSession;
|
|
294
307
|
private removeWebRtcAudioUnlockHandler;
|
|
295
308
|
private connectProtocolOnMainThread;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AuthResponse } from '../../../../shared/protocol/src/index.ts';
|
|
2
2
|
import { ApiKeyConfig, LocalConfig, SessionTokenConfig } from '../client/ikon-client-config';
|
|
3
|
+
import { ProxyMode } from '../client/endpoint-selector';
|
|
3
4
|
/**
|
|
4
5
|
* Result of authentication - contains the AuthResponse from the server.
|
|
5
6
|
*/
|
|
6
7
|
export interface AuthResult {
|
|
7
8
|
authResponse: AuthResponse;
|
|
9
|
+
usedProxyUrl?: boolean;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Common authentication logic - fetch the connect URL and decode the AuthResponse.
|
|
@@ -29,7 +31,7 @@ export declare function authenticateLocal(config: LocalConfig, signal?: AbortSig
|
|
|
29
31
|
* 5. POST /rooms/connect and poll until running
|
|
30
32
|
* 6. Connect to the returned Ikon server URL
|
|
31
33
|
*/
|
|
32
|
-
export declare function authenticateApiKey(config: ApiKeyConfig, signal?: AbortSignal): Promise<AuthResult>;
|
|
34
|
+
export declare function authenticateApiKey(config: ApiKeyConfig, signal?: AbortSignal, proxyMode?: ProxyMode, proxyPreferred?: boolean): Promise<AuthResult>;
|
|
33
35
|
/**
|
|
34
36
|
* Authenticate with the Ikon backend using a pre-obtained session token.
|
|
35
37
|
* Use this when the token was obtained from auth.ikonai.com (OAuth) or /auth/anonymous.
|
|
@@ -41,4 +43,4 @@ export declare function authenticateApiKey(config: ApiKeyConfig, signal?: AbortS
|
|
|
41
43
|
* 4. POST /rooms/connect and poll until running
|
|
42
44
|
* 5. Connect to the returned Ikon server URL
|
|
43
45
|
*/
|
|
44
|
-
export declare function authenticateSessionToken(config: SessionTokenConfig, signal?: AbortSignal): Promise<AuthResult>;
|
|
46
|
+
export declare function authenticateSessionToken(config: SessionTokenConfig, signal?: AbortSignal, proxyMode?: ProxyMode, proxyPreferred?: boolean): Promise<AuthResult>;
|
package/connection/urls.d.ts
CHANGED
|
@@ -45,6 +45,11 @@ export declare function deriveBackendType(): BackendType;
|
|
|
45
45
|
* 4. Default → IKON_AUTH_URL_PROD
|
|
46
46
|
*/
|
|
47
47
|
export declare function deriveAuthUrl(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Read the `?proxy=` query parameter.
|
|
50
|
+
* Returns `true` for `?proxy=true`, `false` for `?proxy=false`, `null` otherwise.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getProxyQueryParam(): boolean | null;
|
|
48
53
|
/**
|
|
49
54
|
* Parse URL query parameters.
|
|
50
55
|
*/
|
package/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { ConnectionState } from './client/connection-state';
|
|
|
4
4
|
export { isConnecting, isConnected, isOffline, isError } from './client/connection-state';
|
|
5
5
|
export { ChannelManager, type ChannelManagerConfig, type ChannelManagerState } from './channel/channel-manager';
|
|
6
6
|
export { Channel, type ChannelConfig, type ChannelState } from './channel/channel';
|
|
7
|
-
export { EndpointSelector } from './client/endpoint-selector';
|
|
7
|
+
export { EndpointSelector, type ProxyMode } from './client/endpoint-selector';
|
|
8
8
|
export { ConnectionError, AuthenticationError, TransportError, KeepaliveTimeoutError, MaxRetriesExceededError, ProvisioningTimeoutError, ChannelNotFoundError, SpaceNotFoundError, NoChannelsError } from './errors';
|
|
9
9
|
export { Opcode, EntrypointType, UserType, ClientType, ContextType } from '../../../shared/protocol/src/index.ts';
|
|
10
10
|
export type { ClientReady, GlobalState, ProtocolMessage, ProtocolMessageHeaders } from '../../../shared/protocol/src/index.ts';
|