connectbase-client 5.7.0 → 5.9.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/CHANGELOG.md +63 -0
- package/dist/cli.js +8 -1
- package/dist/connect-base.umd.js +4 -4
- package/dist/index.d.mts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +72 -4
- package/dist/index.mjs +72 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3691,6 +3691,24 @@ interface RoomStaleMessage {
|
|
|
3691
3691
|
scriptVersion?: number;
|
|
3692
3692
|
serverTime: number;
|
|
3693
3693
|
}
|
|
3694
|
+
/**
|
|
3695
|
+
* sync_lost 이벤트 페이로드.
|
|
3696
|
+
*
|
|
3697
|
+
* 서버가 이 클라이언트로 보내는 송신 버퍼가 가득 차서 delta 를 버렸을 때 발화된다.
|
|
3698
|
+
* delta 는 직전 상태에 누적 적용되므로 하나만 놓쳐도 이후 상태가 계속 어긋난다.
|
|
3699
|
+
*
|
|
3700
|
+
* SDK 는 이 메시지를 받으면 `get_state` 로 전체 상태를 다시 받아 자동 복구한다
|
|
3701
|
+
* (최소 1초 간격으로 억제 — 혼잡 상황에서 요청 폭풍을 만들지 않기 위함).
|
|
3702
|
+
* 게임 쪽에서 추가로 할 일은 없고, 필요하면 로딩 표시나 계측에 쓴다.
|
|
3703
|
+
*/
|
|
3704
|
+
interface SyncLostMessage {
|
|
3705
|
+
roomId: string;
|
|
3706
|
+
/** 유실이 감지된 tick. */
|
|
3707
|
+
tick: number;
|
|
3708
|
+
/** 서버가 준 사람용 힌트 문자열. */
|
|
3709
|
+
hint: string;
|
|
3710
|
+
serverTime: number;
|
|
3711
|
+
}
|
|
3694
3712
|
/**
|
|
3695
3713
|
* 게임 클라이언트 이벤트 핸들러
|
|
3696
3714
|
*/
|
|
@@ -3732,6 +3750,14 @@ interface GameEventHandlers {
|
|
|
3732
3750
|
* 미설정 시 SDK 는 console.warn 으로 가시화만 하고 자동 동작은 하지 않는다.
|
|
3733
3751
|
*/
|
|
3734
3752
|
onRoomStale?: (msg: RoomStaleMessage) => void;
|
|
3753
|
+
/**
|
|
3754
|
+
* delta 유실이 감지됐을 때 발화 (`SyncLostMessage` 참고).
|
|
3755
|
+
*
|
|
3756
|
+
* **복구는 SDK 가 자동으로 한다** — 이 핸들러는 통지용이다. SDK 는 곧바로
|
|
3757
|
+
* `get_state` 로 전체 상태를 다시 받아 기준점을 맞추고, 결과는 평소처럼
|
|
3758
|
+
* `onStateUpdate` 로 전달한다. 이 콜백은 로딩 표시나 계측 용도로 쓴다.
|
|
3759
|
+
*/
|
|
3760
|
+
onSyncLost?: (msg: SyncLostMessage) => void;
|
|
3735
3761
|
}
|
|
3736
3762
|
/**
|
|
3737
3763
|
* 게임 클라이언트 설정
|
|
@@ -4282,9 +4308,23 @@ declare class GameRoom {
|
|
|
4282
4308
|
ping(): Promise<number>;
|
|
4283
4309
|
private buildConnectionUrl;
|
|
4284
4310
|
private msgIdCounter;
|
|
4311
|
+
/** sync_lost 자동 재동기화 억제 상태 — handleSyncLost 참고. */
|
|
4312
|
+
private resyncInFlight;
|
|
4313
|
+
private lastResyncAt;
|
|
4285
4314
|
private send;
|
|
4286
4315
|
private sendWithHandler;
|
|
4287
4316
|
private handleMessage;
|
|
4317
|
+
/**
|
|
4318
|
+
* `sync_lost` 처리 — broadcaster 가 이 클라이언트로 보내는 버퍼가 넘쳐서 delta 를
|
|
4319
|
+
* 몇 개 버렸다는 서버의 통지다. delta 는 이전 상태에 누적 적용되므로, 하나라도
|
|
4320
|
+
* 놓치면 이후 모든 상태가 어긋난 채로 계속 간다. 그래서 전체 상태를 다시 받아
|
|
4321
|
+
* 기준점을 맞춘다 (서버 규약: `app/game/room.go` 의 emitSyncLostHintIfNeeded).
|
|
4322
|
+
*
|
|
4323
|
+
* 서버는 버퍼가 계속 막혀 있으면 tick 마다 재시도하므로 두 겹으로 억제한다 —
|
|
4324
|
+
* 이미 재동기화가 진행 중이면 건너뛰고, 최소 간격 안의 중복 통지도 무시한다.
|
|
4325
|
+
* 안 그러면 혼잡한 상황에서 get_state 폭풍이 혼잡을 더 키운다.
|
|
4326
|
+
*/
|
|
4327
|
+
private handleSyncLost;
|
|
4288
4328
|
private handleDelta;
|
|
4289
4329
|
private applyChange;
|
|
4290
4330
|
private handlePlayerEvent;
|
|
@@ -10467,4 +10507,4 @@ declare class ConnectBase {
|
|
|
10467
10507
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
10468
10508
|
}
|
|
10469
10509
|
|
|
10470
|
-
export { AIAPI, type AIChatOptions, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptLogEntry, type ScriptLogsResponse, type ScriptMeta, type ScriptMetricsResponse, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
|
|
10510
|
+
export { AIAPI, type AIChatOptions, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptLogEntry, type ScriptLogsResponse, type ScriptMeta, type ScriptMetricsResponse, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SyncLostMessage, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
|
package/dist/index.d.ts
CHANGED
|
@@ -3691,6 +3691,24 @@ interface RoomStaleMessage {
|
|
|
3691
3691
|
scriptVersion?: number;
|
|
3692
3692
|
serverTime: number;
|
|
3693
3693
|
}
|
|
3694
|
+
/**
|
|
3695
|
+
* sync_lost 이벤트 페이로드.
|
|
3696
|
+
*
|
|
3697
|
+
* 서버가 이 클라이언트로 보내는 송신 버퍼가 가득 차서 delta 를 버렸을 때 발화된다.
|
|
3698
|
+
* delta 는 직전 상태에 누적 적용되므로 하나만 놓쳐도 이후 상태가 계속 어긋난다.
|
|
3699
|
+
*
|
|
3700
|
+
* SDK 는 이 메시지를 받으면 `get_state` 로 전체 상태를 다시 받아 자동 복구한다
|
|
3701
|
+
* (최소 1초 간격으로 억제 — 혼잡 상황에서 요청 폭풍을 만들지 않기 위함).
|
|
3702
|
+
* 게임 쪽에서 추가로 할 일은 없고, 필요하면 로딩 표시나 계측에 쓴다.
|
|
3703
|
+
*/
|
|
3704
|
+
interface SyncLostMessage {
|
|
3705
|
+
roomId: string;
|
|
3706
|
+
/** 유실이 감지된 tick. */
|
|
3707
|
+
tick: number;
|
|
3708
|
+
/** 서버가 준 사람용 힌트 문자열. */
|
|
3709
|
+
hint: string;
|
|
3710
|
+
serverTime: number;
|
|
3711
|
+
}
|
|
3694
3712
|
/**
|
|
3695
3713
|
* 게임 클라이언트 이벤트 핸들러
|
|
3696
3714
|
*/
|
|
@@ -3732,6 +3750,14 @@ interface GameEventHandlers {
|
|
|
3732
3750
|
* 미설정 시 SDK 는 console.warn 으로 가시화만 하고 자동 동작은 하지 않는다.
|
|
3733
3751
|
*/
|
|
3734
3752
|
onRoomStale?: (msg: RoomStaleMessage) => void;
|
|
3753
|
+
/**
|
|
3754
|
+
* delta 유실이 감지됐을 때 발화 (`SyncLostMessage` 참고).
|
|
3755
|
+
*
|
|
3756
|
+
* **복구는 SDK 가 자동으로 한다** — 이 핸들러는 통지용이다. SDK 는 곧바로
|
|
3757
|
+
* `get_state` 로 전체 상태를 다시 받아 기준점을 맞추고, 결과는 평소처럼
|
|
3758
|
+
* `onStateUpdate` 로 전달한다. 이 콜백은 로딩 표시나 계측 용도로 쓴다.
|
|
3759
|
+
*/
|
|
3760
|
+
onSyncLost?: (msg: SyncLostMessage) => void;
|
|
3735
3761
|
}
|
|
3736
3762
|
/**
|
|
3737
3763
|
* 게임 클라이언트 설정
|
|
@@ -4282,9 +4308,23 @@ declare class GameRoom {
|
|
|
4282
4308
|
ping(): Promise<number>;
|
|
4283
4309
|
private buildConnectionUrl;
|
|
4284
4310
|
private msgIdCounter;
|
|
4311
|
+
/** sync_lost 자동 재동기화 억제 상태 — handleSyncLost 참고. */
|
|
4312
|
+
private resyncInFlight;
|
|
4313
|
+
private lastResyncAt;
|
|
4285
4314
|
private send;
|
|
4286
4315
|
private sendWithHandler;
|
|
4287
4316
|
private handleMessage;
|
|
4317
|
+
/**
|
|
4318
|
+
* `sync_lost` 처리 — broadcaster 가 이 클라이언트로 보내는 버퍼가 넘쳐서 delta 를
|
|
4319
|
+
* 몇 개 버렸다는 서버의 통지다. delta 는 이전 상태에 누적 적용되므로, 하나라도
|
|
4320
|
+
* 놓치면 이후 모든 상태가 어긋난 채로 계속 간다. 그래서 전체 상태를 다시 받아
|
|
4321
|
+
* 기준점을 맞춘다 (서버 규약: `app/game/room.go` 의 emitSyncLostHintIfNeeded).
|
|
4322
|
+
*
|
|
4323
|
+
* 서버는 버퍼가 계속 막혀 있으면 tick 마다 재시도하므로 두 겹으로 억제한다 —
|
|
4324
|
+
* 이미 재동기화가 진행 중이면 건너뛰고, 최소 간격 안의 중복 통지도 무시한다.
|
|
4325
|
+
* 안 그러면 혼잡한 상황에서 get_state 폭풍이 혼잡을 더 키운다.
|
|
4326
|
+
*/
|
|
4327
|
+
private handleSyncLost;
|
|
4288
4328
|
private handleDelta;
|
|
4289
4329
|
private applyChange;
|
|
4290
4330
|
private handlePlayerEvent;
|
|
@@ -10467,4 +10507,4 @@ declare class ConnectBase {
|
|
|
10467
10507
|
updateConfig(config: Partial<ConnectBaseConfig>): void;
|
|
10468
10508
|
}
|
|
10469
10509
|
|
|
10470
|
-
export { AIAPI, type AIChatOptions, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptLogEntry, type ScriptLogsResponse, type ScriptMeta, type ScriptMetricsResponse, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
|
|
10510
|
+
export { AIAPI, type AIChatOptions, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, AIError, type AIErrorCode, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppMemberDetail, type AppMemberIdentityDetail, type AppMemberIdentitySummary, type AppMemberList, type AppMemberListItem, type AppMemberProviderType, AppMembersAPI, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListAppMembersOptions, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PostponeBillingRequest, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublicKeyPaymentMode, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptLogEntry, type ScriptLogsResponse, type ScriptMeta, type ScriptMetricsResponse, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SyncLostMessage, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toAIError, toCreateRoomWire };
|
package/dist/index.js
CHANGED
|
@@ -3742,6 +3742,7 @@ function parseGameError(msg) {
|
|
|
3742
3742
|
available: get("available") || msg.available
|
|
3743
3743
|
});
|
|
3744
3744
|
}
|
|
3745
|
+
var SYNC_LOST_RESYNC_MIN_INTERVAL_MS = 1e3;
|
|
3745
3746
|
var getDefaultGameServerUrl = () => {
|
|
3746
3747
|
if (typeof window !== "undefined") {
|
|
3747
3748
|
const hostname = window.location.hostname;
|
|
@@ -3776,6 +3777,9 @@ var GameRoom = class {
|
|
|
3776
3777
|
this._scriptVersion = null;
|
|
3777
3778
|
this._isConnected = false;
|
|
3778
3779
|
this.msgIdCounter = 0;
|
|
3780
|
+
/** sync_lost 자동 재동기화 억제 상태 — handleSyncLost 참고. */
|
|
3781
|
+
this.resyncInFlight = false;
|
|
3782
|
+
this.lastResyncAt = 0;
|
|
3779
3783
|
this.config = {
|
|
3780
3784
|
gameServerUrl: getDefaultGameServerUrl(),
|
|
3781
3785
|
autoReconnect: true,
|
|
@@ -4086,6 +4090,11 @@ var GameRoom = class {
|
|
|
4086
4090
|
const baseUrl = this.config.gameServerUrl;
|
|
4087
4091
|
const wsUrl = baseUrl.replace(/^http/, "ws");
|
|
4088
4092
|
const params = new URLSearchParams();
|
|
4093
|
+
if (!this.config.clientId) {
|
|
4094
|
+
throw new Error(
|
|
4095
|
+
"cb.game: clientId is required to build a game connection URL. Pass it via `cb.game.createClient({ appId, clientId })`."
|
|
4096
|
+
);
|
|
4097
|
+
}
|
|
4089
4098
|
params.set("client_id", this.config.clientId);
|
|
4090
4099
|
if (roomId) {
|
|
4091
4100
|
params.set("room_id", roomId);
|
|
@@ -4176,6 +4185,25 @@ var GameRoom = class {
|
|
|
4176
4185
|
case "error":
|
|
4177
4186
|
this.handlers.onError?.(parseGameError(msg));
|
|
4178
4187
|
break;
|
|
4188
|
+
case "sync_lost":
|
|
4189
|
+
this.handleSyncLost(msg);
|
|
4190
|
+
break;
|
|
4191
|
+
case "room_stale":
|
|
4192
|
+
if (this.handlers.onRoomStale) {
|
|
4193
|
+
this.handlers.onRoomStale({
|
|
4194
|
+
reason: msg.reason || "unknown",
|
|
4195
|
+
roomId: msg.room_id || "",
|
|
4196
|
+
scriptId: msg.script_id,
|
|
4197
|
+
scriptVersion: msg.script_version,
|
|
4198
|
+
serverTime: msg.server_time || 0
|
|
4199
|
+
});
|
|
4200
|
+
} else {
|
|
4201
|
+
console.warn(
|
|
4202
|
+
"[connect-base game] room_stale received but onRoomStale handler not set:",
|
|
4203
|
+
msg.reason
|
|
4204
|
+
);
|
|
4205
|
+
}
|
|
4206
|
+
break;
|
|
4179
4207
|
default:
|
|
4180
4208
|
this.handlers.onMessage?.(
|
|
4181
4209
|
msg
|
|
@@ -4186,6 +4214,34 @@ var GameRoom = class {
|
|
|
4186
4214
|
console.error("Failed to parse game message:", data);
|
|
4187
4215
|
}
|
|
4188
4216
|
}
|
|
4217
|
+
/**
|
|
4218
|
+
* `sync_lost` 처리 — broadcaster 가 이 클라이언트로 보내는 버퍼가 넘쳐서 delta 를
|
|
4219
|
+
* 몇 개 버렸다는 서버의 통지다. delta 는 이전 상태에 누적 적용되므로, 하나라도
|
|
4220
|
+
* 놓치면 이후 모든 상태가 어긋난 채로 계속 간다. 그래서 전체 상태를 다시 받아
|
|
4221
|
+
* 기준점을 맞춘다 (서버 규약: `app/game/room.go` 의 emitSyncLostHintIfNeeded).
|
|
4222
|
+
*
|
|
4223
|
+
* 서버는 버퍼가 계속 막혀 있으면 tick 마다 재시도하므로 두 겹으로 억제한다 —
|
|
4224
|
+
* 이미 재동기화가 진행 중이면 건너뛰고, 최소 간격 안의 중복 통지도 무시한다.
|
|
4225
|
+
* 안 그러면 혼잡한 상황에서 get_state 폭풍이 혼잡을 더 키운다.
|
|
4226
|
+
*/
|
|
4227
|
+
handleSyncLost(msg) {
|
|
4228
|
+
this.handlers.onSyncLost?.({
|
|
4229
|
+
roomId: msg.room_id || "",
|
|
4230
|
+
tick: msg.tick || 0,
|
|
4231
|
+
hint: msg.hint || "",
|
|
4232
|
+
serverTime: msg.server_time || 0
|
|
4233
|
+
});
|
|
4234
|
+
if (this.resyncInFlight) return;
|
|
4235
|
+
const now = Date.now();
|
|
4236
|
+
if (now - this.lastResyncAt < SYNC_LOST_RESYNC_MIN_INTERVAL_MS) return;
|
|
4237
|
+
this.resyncInFlight = true;
|
|
4238
|
+
this.lastResyncAt = now;
|
|
4239
|
+
this.requestState().catch((err) => {
|
|
4240
|
+
console.warn("[connect-base game] sync_lost resync failed:", err);
|
|
4241
|
+
}).finally(() => {
|
|
4242
|
+
this.resyncInFlight = false;
|
|
4243
|
+
});
|
|
4244
|
+
}
|
|
4189
4245
|
handleDelta(msg) {
|
|
4190
4246
|
const raw = msg.delta;
|
|
4191
4247
|
if (!raw) return;
|
|
@@ -12035,6 +12091,14 @@ var HttpClient = class {
|
|
|
12035
12091
|
};
|
|
12036
12092
|
|
|
12037
12093
|
// src/api/game-transport.ts
|
|
12094
|
+
function requireClientId(clientId) {
|
|
12095
|
+
if (!clientId) {
|
|
12096
|
+
throw new Error(
|
|
12097
|
+
"cb.game: clientId is required to build a game connection URL. Pass it via `cb.game.createClient({ appId, clientId })`."
|
|
12098
|
+
);
|
|
12099
|
+
}
|
|
12100
|
+
return clientId;
|
|
12101
|
+
}
|
|
12038
12102
|
var WebTransportTransport = class {
|
|
12039
12103
|
constructor(config, onMessage, onClose, onError) {
|
|
12040
12104
|
this.type = "webtransport";
|
|
@@ -12065,7 +12129,7 @@ var WebTransportTransport = class {
|
|
|
12065
12129
|
const baseUrl = this.config.gameServerUrl || "https://game.connectbase.world";
|
|
12066
12130
|
const httpsUrl = baseUrl.replace(/^ws/, "http").replace(/^http:/, "https:");
|
|
12067
12131
|
const params = new URLSearchParams();
|
|
12068
|
-
params.set("client_id", this.config.clientId);
|
|
12132
|
+
params.set("client_id", requireClientId(this.config.clientId));
|
|
12069
12133
|
if (this.config.publicKey) {
|
|
12070
12134
|
params.set("public_key", this.config.publicKey);
|
|
12071
12135
|
}
|
|
@@ -12190,15 +12254,19 @@ var WebSocketTransport = class {
|
|
|
12190
12254
|
const baseUrl = this.config.gameServerUrl || "wss://game.connectbase.world";
|
|
12191
12255
|
const wsUrl = baseUrl.replace(/^http/, "ws");
|
|
12192
12256
|
const params = new URLSearchParams();
|
|
12193
|
-
params.set("client_id", this.config.clientId);
|
|
12257
|
+
params.set("client_id", requireClientId(this.config.clientId));
|
|
12194
12258
|
if (this.config.publicKey) {
|
|
12195
12259
|
params.set("public_key", this.config.publicKey);
|
|
12196
12260
|
}
|
|
12197
12261
|
if (this.config.accessToken) {
|
|
12198
12262
|
params.set("token", this.config.accessToken);
|
|
12199
12263
|
}
|
|
12200
|
-
|
|
12201
|
-
|
|
12264
|
+
if (!this.config.appId) {
|
|
12265
|
+
throw new Error(
|
|
12266
|
+
"cb.game: appId is required to build a game connection URL. Pass it to `new ConnectBase({ appId })` or per-client via `cb.game.createClient({ appId, clientId })`."
|
|
12267
|
+
);
|
|
12268
|
+
}
|
|
12269
|
+
return `${wsUrl}/v1/game/${this.config.appId}/ws?${params.toString()}`;
|
|
12202
12270
|
}
|
|
12203
12271
|
disconnect() {
|
|
12204
12272
|
if (this.ws) {
|
package/dist/index.mjs
CHANGED
|
@@ -3693,6 +3693,7 @@ function parseGameError(msg) {
|
|
|
3693
3693
|
available: get("available") || msg.available
|
|
3694
3694
|
});
|
|
3695
3695
|
}
|
|
3696
|
+
var SYNC_LOST_RESYNC_MIN_INTERVAL_MS = 1e3;
|
|
3696
3697
|
var getDefaultGameServerUrl = () => {
|
|
3697
3698
|
if (typeof window !== "undefined") {
|
|
3698
3699
|
const hostname = window.location.hostname;
|
|
@@ -3727,6 +3728,9 @@ var GameRoom = class {
|
|
|
3727
3728
|
this._scriptVersion = null;
|
|
3728
3729
|
this._isConnected = false;
|
|
3729
3730
|
this.msgIdCounter = 0;
|
|
3731
|
+
/** sync_lost 자동 재동기화 억제 상태 — handleSyncLost 참고. */
|
|
3732
|
+
this.resyncInFlight = false;
|
|
3733
|
+
this.lastResyncAt = 0;
|
|
3730
3734
|
this.config = {
|
|
3731
3735
|
gameServerUrl: getDefaultGameServerUrl(),
|
|
3732
3736
|
autoReconnect: true,
|
|
@@ -4037,6 +4041,11 @@ var GameRoom = class {
|
|
|
4037
4041
|
const baseUrl = this.config.gameServerUrl;
|
|
4038
4042
|
const wsUrl = baseUrl.replace(/^http/, "ws");
|
|
4039
4043
|
const params = new URLSearchParams();
|
|
4044
|
+
if (!this.config.clientId) {
|
|
4045
|
+
throw new Error(
|
|
4046
|
+
"cb.game: clientId is required to build a game connection URL. Pass it via `cb.game.createClient({ appId, clientId })`."
|
|
4047
|
+
);
|
|
4048
|
+
}
|
|
4040
4049
|
params.set("client_id", this.config.clientId);
|
|
4041
4050
|
if (roomId) {
|
|
4042
4051
|
params.set("room_id", roomId);
|
|
@@ -4127,6 +4136,25 @@ var GameRoom = class {
|
|
|
4127
4136
|
case "error":
|
|
4128
4137
|
this.handlers.onError?.(parseGameError(msg));
|
|
4129
4138
|
break;
|
|
4139
|
+
case "sync_lost":
|
|
4140
|
+
this.handleSyncLost(msg);
|
|
4141
|
+
break;
|
|
4142
|
+
case "room_stale":
|
|
4143
|
+
if (this.handlers.onRoomStale) {
|
|
4144
|
+
this.handlers.onRoomStale({
|
|
4145
|
+
reason: msg.reason || "unknown",
|
|
4146
|
+
roomId: msg.room_id || "",
|
|
4147
|
+
scriptId: msg.script_id,
|
|
4148
|
+
scriptVersion: msg.script_version,
|
|
4149
|
+
serverTime: msg.server_time || 0
|
|
4150
|
+
});
|
|
4151
|
+
} else {
|
|
4152
|
+
console.warn(
|
|
4153
|
+
"[connect-base game] room_stale received but onRoomStale handler not set:",
|
|
4154
|
+
msg.reason
|
|
4155
|
+
);
|
|
4156
|
+
}
|
|
4157
|
+
break;
|
|
4130
4158
|
default:
|
|
4131
4159
|
this.handlers.onMessage?.(
|
|
4132
4160
|
msg
|
|
@@ -4137,6 +4165,34 @@ var GameRoom = class {
|
|
|
4137
4165
|
console.error("Failed to parse game message:", data);
|
|
4138
4166
|
}
|
|
4139
4167
|
}
|
|
4168
|
+
/**
|
|
4169
|
+
* `sync_lost` 처리 — broadcaster 가 이 클라이언트로 보내는 버퍼가 넘쳐서 delta 를
|
|
4170
|
+
* 몇 개 버렸다는 서버의 통지다. delta 는 이전 상태에 누적 적용되므로, 하나라도
|
|
4171
|
+
* 놓치면 이후 모든 상태가 어긋난 채로 계속 간다. 그래서 전체 상태를 다시 받아
|
|
4172
|
+
* 기준점을 맞춘다 (서버 규약: `app/game/room.go` 의 emitSyncLostHintIfNeeded).
|
|
4173
|
+
*
|
|
4174
|
+
* 서버는 버퍼가 계속 막혀 있으면 tick 마다 재시도하므로 두 겹으로 억제한다 —
|
|
4175
|
+
* 이미 재동기화가 진행 중이면 건너뛰고, 최소 간격 안의 중복 통지도 무시한다.
|
|
4176
|
+
* 안 그러면 혼잡한 상황에서 get_state 폭풍이 혼잡을 더 키운다.
|
|
4177
|
+
*/
|
|
4178
|
+
handleSyncLost(msg) {
|
|
4179
|
+
this.handlers.onSyncLost?.({
|
|
4180
|
+
roomId: msg.room_id || "",
|
|
4181
|
+
tick: msg.tick || 0,
|
|
4182
|
+
hint: msg.hint || "",
|
|
4183
|
+
serverTime: msg.server_time || 0
|
|
4184
|
+
});
|
|
4185
|
+
if (this.resyncInFlight) return;
|
|
4186
|
+
const now = Date.now();
|
|
4187
|
+
if (now - this.lastResyncAt < SYNC_LOST_RESYNC_MIN_INTERVAL_MS) return;
|
|
4188
|
+
this.resyncInFlight = true;
|
|
4189
|
+
this.lastResyncAt = now;
|
|
4190
|
+
this.requestState().catch((err) => {
|
|
4191
|
+
console.warn("[connect-base game] sync_lost resync failed:", err);
|
|
4192
|
+
}).finally(() => {
|
|
4193
|
+
this.resyncInFlight = false;
|
|
4194
|
+
});
|
|
4195
|
+
}
|
|
4140
4196
|
handleDelta(msg) {
|
|
4141
4197
|
const raw = msg.delta;
|
|
4142
4198
|
if (!raw) return;
|
|
@@ -11986,6 +12042,14 @@ var HttpClient = class {
|
|
|
11986
12042
|
};
|
|
11987
12043
|
|
|
11988
12044
|
// src/api/game-transport.ts
|
|
12045
|
+
function requireClientId(clientId) {
|
|
12046
|
+
if (!clientId) {
|
|
12047
|
+
throw new Error(
|
|
12048
|
+
"cb.game: clientId is required to build a game connection URL. Pass it via `cb.game.createClient({ appId, clientId })`."
|
|
12049
|
+
);
|
|
12050
|
+
}
|
|
12051
|
+
return clientId;
|
|
12052
|
+
}
|
|
11989
12053
|
var WebTransportTransport = class {
|
|
11990
12054
|
constructor(config, onMessage, onClose, onError) {
|
|
11991
12055
|
this.type = "webtransport";
|
|
@@ -12016,7 +12080,7 @@ var WebTransportTransport = class {
|
|
|
12016
12080
|
const baseUrl = this.config.gameServerUrl || "https://game.connectbase.world";
|
|
12017
12081
|
const httpsUrl = baseUrl.replace(/^ws/, "http").replace(/^http:/, "https:");
|
|
12018
12082
|
const params = new URLSearchParams();
|
|
12019
|
-
params.set("client_id", this.config.clientId);
|
|
12083
|
+
params.set("client_id", requireClientId(this.config.clientId));
|
|
12020
12084
|
if (this.config.publicKey) {
|
|
12021
12085
|
params.set("public_key", this.config.publicKey);
|
|
12022
12086
|
}
|
|
@@ -12141,15 +12205,19 @@ var WebSocketTransport = class {
|
|
|
12141
12205
|
const baseUrl = this.config.gameServerUrl || "wss://game.connectbase.world";
|
|
12142
12206
|
const wsUrl = baseUrl.replace(/^http/, "ws");
|
|
12143
12207
|
const params = new URLSearchParams();
|
|
12144
|
-
params.set("client_id", this.config.clientId);
|
|
12208
|
+
params.set("client_id", requireClientId(this.config.clientId));
|
|
12145
12209
|
if (this.config.publicKey) {
|
|
12146
12210
|
params.set("public_key", this.config.publicKey);
|
|
12147
12211
|
}
|
|
12148
12212
|
if (this.config.accessToken) {
|
|
12149
12213
|
params.set("token", this.config.accessToken);
|
|
12150
12214
|
}
|
|
12151
|
-
|
|
12152
|
-
|
|
12215
|
+
if (!this.config.appId) {
|
|
12216
|
+
throw new Error(
|
|
12217
|
+
"cb.game: appId is required to build a game connection URL. Pass it to `new ConnectBase({ appId })` or per-client via `cb.game.createClient({ appId, clientId })`."
|
|
12218
|
+
);
|
|
12219
|
+
}
|
|
12220
|
+
return `${wsUrl}/v1/game/${this.config.appId}/ws?${params.toString()}`;
|
|
12153
12221
|
}
|
|
12154
12222
|
disconnect() {
|
|
12155
12223
|
if (this.ws) {
|