@skyway-sdk/core
Version:
The official Next Generation JavaScript SDK for SkyWay
135 lines • 6.38 kB
TypeScript
import { type EventInterface, type RuntimeInfo, type SkyWayErrorInterface } from '@skyway-sdk/common';
import type model from '@skyway-sdk/model';
import { RtcApiClient } from '@skyway-sdk/rtc-api-client';
import { SkyWayAuthToken } from '@skyway-sdk/token';
import type { SkyWayChannelImpl } from './channel';
import { ContextConfig, type SkyWayConfigOptions, type SkyWayContextConfig } from './config';
import { type AnalyticsSession } from './external/analytics';
import type { RemoteMemberImplInterface } from './member/remoteMember';
import type { SkyWayPlugin, SkyWayPluginInterface } from './plugin/interface/plugin';
export interface SkyWayContextInterface {
/**@description [japanese] コンテキストの設定 */
config: SkyWayContextConfig;
/**@description [japanese] SkyWayのアプリケーションID */
readonly appId: string;
/**@description [japanese] コンテキストが破棄済みかどうかを示すフラグ */
readonly disposed: boolean;
/**@description [japanese] トークンのエンコード済み文字列 */
readonly authTokenString: string;
/**@description [japanese] トークンの期限がまもなく切れることを通知するイベント */
readonly onTokenUpdateReminder: EventInterface<void>;
/**@description [japanese] トークンの期限切れを通知するイベント。このイベントが発火された場合、トークンを更新するまでサービスを利用できない */
readonly onTokenExpired: EventInterface<void>;
/**@description [japanese] 回復不能なエラーが発生したことを通知するイベント。インターネット接続状況を確認した上で別のインスタンスを作り直す必要がある */
readonly onFatalError: EventInterface<SkyWayErrorInterface>;
/**@description [japanese] トークンが更新されたことを通知するイベント */
readonly onTokenUpdated: EventInterface<string>;
/**@description [japanese] コンテキストが破棄されたことを通知するイベント */
readonly onDisposed: EventInterface<void>;
/**@private @deprecated */
readonly _onTokenUpdated: EventInterface<string>;
/**@private @deprecated */
readonly _onDisposed: EventInterface<void>;
/**@description [japanese] トークンの更新 */
updateAuthToken(token: string): Promise<void>;
/**@description [japanese] プラグインの登録 */
registerPlugin(plugin: SkyWayPluginInterface): void;
/**
* @description [japanese] コンテキストの利用を終了し次のリソースを解放する
* - イベントリスナー
* - バックエンドサーバとの通信
* - コンテキストを参照する全Channelインスタンス
*/
dispose(): void;
}
export declare class SkyWayContext implements SkyWayContextInterface {
config: ContextConfig;
authToken: SkyWayAuthToken;
/**@internal */
readonly info: {
endpoint: EndpointInfo;
runtime: RuntimeInfo;
};
/**@internal */
static version: string;
/**@internal */
static id: string;
/**
* @description [japanese] Contextの作成
*/
static Create(authTokenString: string, configOptions?: Partial<SkyWayConfigOptions>): Promise<SkyWayContext>;
readonly appId: string;
disposed: boolean;
/**@internal */
plugins: SkyWayPlugin[];
private _unknownPlugin;
/**@internal */
analyticsSession: AnalyticsSession | undefined;
/**@private */
readonly _api: RtcApiClient;
private _authTokenString;
/**seconds */
private _remindSec;
private _tokenUpdateRemindTimer;
private _tokenExpiredTimer;
private _events;
/**
* @description [japanese] トークンの期限がまもなく切れることを通知するイベント
* @example
* context.onTokenUpdateReminder.add(() => {
context.updateAuthToken(tokenString);
});
*/
readonly onTokenUpdateReminder: import("@skyway-sdk/common").Event<void>;
/**
* @description [japanese] トークンの期限切れを通知するイベント。このイベントが発火された場合、トークンを更新するまでサービスを利用できない
*/
readonly onTokenExpired: import("@skyway-sdk/common").Event<void>;
/**
* @description [japanese] 回復不能なエラーが発生したことを通知するイベント。インターネット接続状況を確認した上で別のインスタンスを作り直す必要がある
*/
readonly onFatalError: import("@skyway-sdk/common").Event<SkyWayErrorInterface>;
/**@private @deprecated */
readonly _onTokenUpdated: import("@skyway-sdk/common").Event<string>;
/**@private @deprecated */
readonly _onDisposed: import("@skyway-sdk/common").Event<void>;
/**@description [japanese] トークンが更新されたことを通知するイベント */
readonly onTokenUpdated: import("@skyway-sdk/common").Event<string>;
/**@description [japanese] コンテキストが破棄されたことを通知するイベント */
readonly onDisposed: import("@skyway-sdk/common").Event<void>;
/**@private */
constructor(api: RtcApiClient, config: ContextConfig, authToken: SkyWayAuthToken,
/**@internal */
info: {
endpoint: EndpointInfo;
runtime: RuntimeInfo;
});
/**@description [japanese] トークンのエンコード済み文字列 */
get authTokenString(): string;
/**@internal */
_setTokenExpireTimer(): Promise<void>;
/**
* @description [japanese] トークンの更新
*/
updateAuthToken(token: string): Promise<void>;
/**
* @description [japanese] プラグインの登録
*/
registerPlugin(plugin: SkyWayPlugin): void;
/**@private */
_createRemoteMember(channel: SkyWayChannelImpl, memberDto: model.Member): RemoteMemberImplInterface;
/**
* @description [japanese] Contextの利用を終了し次のリソースを解放する
* - イベントリスナー
* - バックエンドサーバとの通信
* - コンテキストを参照する全Channelインスタンス
*/
dispose(): void;
}
/**@internal */
export interface EndpointInfo {
rapi: string;
signaling: string;
ice: string;
}
//# sourceMappingURL=context.d.ts.map