@ikonai/sdk 1.0.23 → 1.0.24
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.d.ts +2 -0
- package/connection/authenticator.d.ts +4 -2
- package/connection/urls.d.ts +5 -0
- package/index.d.ts +1 -1
- package/index.js +1636 -1586
- 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
|
}
|
package/client/ikon-client.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ export declare class IkonClient {
|
|
|
123
123
|
private _mediaCapture;
|
|
124
124
|
private _webRtcSignaling;
|
|
125
125
|
private _webRtcAudioElements;
|
|
126
|
+
private _webRtcAudioStreams;
|
|
126
127
|
private _webRtcVideoStreams;
|
|
127
128
|
private _webRtcTrackMap;
|
|
128
129
|
private _waitForExternalConnectUrl;
|
|
@@ -290,6 +291,7 @@ export declare class IkonClient {
|
|
|
290
291
|
private _webRtcAudioUnlockHandler;
|
|
291
292
|
private readonly _webRtcMediaSession;
|
|
292
293
|
private playWebRtcAudioTrack;
|
|
294
|
+
private stopWebRtcAudioTrack;
|
|
293
295
|
private setupWebRtcMediaSession;
|
|
294
296
|
private removeWebRtcAudioUnlockHandler;
|
|
295
297
|
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';
|