connectbase-client 3.9.0 → 3.11.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 CHANGED
@@ -3,6 +3,85 @@
3
3
  본 SDK 의 모든 주요 변경사항을 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/) 형식으로 기록합니다.
4
4
  버전은 [Semantic Versioning](https://semver.org/lang/ko/) 을 따릅니다.
5
5
 
6
+ ## [3.11.0] - 2026-05-10
7
+
8
+ ### Fixed — `cb.game.createClient().createRoom()` 의 `scriptName` / 기타 wire 필드 매핑 (platform-issue 019e123a)
9
+
10
+ 게임 룸 생성 시 SDK 의 camelCase config (`scriptName`, `tickRate`, `maxPlayers`, `roomId`,
11
+ `categoryId`) 가 게임 서버 (Go 핸들러 JSON 태그 = snake_case) 가 기대하는 와이어 형식으로
12
+ 매핑되지 않아, **`scriptName` 미전달 → `RoomConfig.ScriptID` 비어 있음 → `onTick` /
13
+ `onPlayerJoin` 등 모든 사용자 Lua hook 이 silent skip** 되던 문제 수정. NJB 앱 보고로 확인.
14
+
15
+ ### Added — `GameRoomConfig.scriptName`
16
+
17
+ ```typescript
18
+ const room = cb.game.createClient({ clientId: 'p1' })
19
+ await room.connect()
20
+ await room.createRoom({
21
+ tickRate: 20,
22
+ maxPlayers: 100,
23
+ scriptName: 'njb-main', // ← 콘솔/REST 로 업로드+활성화한 Lua 스크립트 이름
24
+ })
25
+ ```
26
+
27
+ 지정 시 룸의 `onRoomCreate` / `onPlayerJoin` / `onTick` / `onAction` / `onLeave` 가 해당
28
+ 스크립트로 디스패치된다. 미지정 시 server tick + delta 만 흐르고 사용자 hook 은 호출되지 않음.
29
+
30
+ ### Added — `toCreateRoomWire(config)` 헬퍼 export
31
+
32
+ 테스트/디버깅 용으로 `import { toCreateRoomWire } from 'connectbase-client'`. SDK 가 내부적으로
33
+ `create_room` WebSocket 메시지 생성 시 사용하는 매핑 함수.
34
+
35
+ ### Behavior change — `tickRate` / `maxPlayers` 등이 이제 실제로 적용됨
36
+
37
+ 이전 버전은 camelCase 그대로 와이어로 보냈으나 게임 서버가 snake_case 만 인식해 모든 룸이
38
+ **서버 기본값 (tick_rate=64, max_players=100)** 으로 생성됐다. 본 버전부터 SDK 가 명시한 값이
39
+ 실제로 반영된다. 이전 동작에 의존한 코드가 있다면 명시 값을 검토할 것.
40
+
41
+ ### Backend wiring (참고)
42
+
43
+ 본 fix 는 game-server 의 다음 변경과 짝을 이룬다 (별도 배포 필요):
44
+ - `CreateRoomRequest` 에 `script_name` (+ `script` alias) 필드 추가, `handleCreateRoom` 이
45
+ `RoomConfig.ScriptID = appID:scriptName` 으로 매핑
46
+ - 신규 `scripts.Loader` — 게임 서버 부팅 시 활성 스크립트 일괄 로드 + `game.scripts.reload.>`
47
+ NATS 구독으로 Activate/Rollback/Disable 이벤트를 ScriptEngine 에 반영. legacy `HotReloader`
48
+ 는 다른 subject/schema 라 미사용 코드였음 (이번에 발견된 누락)
49
+
50
+ ## [3.10.0] - 2026-05-10
51
+
52
+ ### Fixed — `/v1/auth/re-issue` 일시 실패에 강제 로그아웃 (platform-issue 019e11cf)
53
+
54
+ `HttpClient.refreshAccessToken()` 가 모든 실패에 즉시 토큰을 폐기해, 5xx / 네트워크 hiccup
55
+ 한 번에 활동 중인 사용자가 강제 로그아웃되던 문제를 수정. OAuth 클라이언트 표준
56
+ (Auth0 SPA SDK / MSAL / Amplify) 에 맞춰 실패를 분류한다.
57
+
58
+ | 응답 | 분류 | 토큰 처리 | 호출되는 콜백 |
59
+ |---|---|---|---|
60
+ | `5xx` / 네트워크 / abort / 손상된 200 | transient | **보존** (다음 호출에서 backoff 후 재시도) | `onTransientRefreshFailure`, `onAuthError` |
61
+ | `401` / `403` / `400 invalid_grant` / `400 invalid_token` | permanent | 폐기 | `onTokenExpired`, `onAuthError` |
62
+ | 그 외 4xx (예: `400 invalid_request`) | client_bug | **보존** (재시도 무의미, 패치 배포로 회복) | `onAuthError` |
63
+
64
+ ### Added — `onTransientRefreshFailure` 콜백
65
+
66
+ 일시적 refresh 실패 시 호출되는 새 콜백. 토큰은 살아있으므로 강제 로그아웃 없이
67
+ "연결이 잠시 불안정합니다" 같은 비파괴 알림을 띄울 때 사용:
68
+
69
+ ```typescript
70
+ const cb = new ConnectBase({
71
+ publicKey: '...',
72
+ onTransientRefreshFailure: () =>
73
+ toast.warn('연결이 잠시 불안정합니다. 잠시 후 자동 복구됩니다.'),
74
+ onTokenExpired: () => { window.location.href = '/login' },
75
+ })
76
+ ```
77
+
78
+ ### Behavior change (semver minor 로 분류한 이유)
79
+
80
+ `onTokenExpired` 의 호출 시점이 **refresh token 자체가 무효화된 경우로 한정**된다.
81
+ 이전 버전에서는 transient 실패에도 호출됐기에, 그 콜백을 "임의 refresh 실패 알림" 으로
82
+ 사용하던 앱은 동작 변화가 있다. transient 알림은 새 `onTransientRefreshFailure` 로 분리.
83
+ `onAuthError` 는 모든 실패에서 호출되는 점은 동일.
84
+
6
85
  ## [3.9.0] - 2026-05-10
7
86
 
8
87
  ### Added — Support API (end-user issue reporting)
package/README.md CHANGED
@@ -321,8 +321,11 @@ Create a new game room.
321
321
  const state = await gameClient.createRoom({
322
322
  roomId: 'my-custom-room', // Optional: Custom room ID
323
323
  categoryId: 'battle-royale', // Optional: Room category
324
- maxPlayers: 100, // Optional: Max players (default: 10)
324
+ maxPlayers: 100, // Optional: Max players (default: 100)
325
325
  tickRate: 64, // Optional: Server tick rate (default: 64)
326
+ scriptName: 'main', // Optional (3.11.0+): Lua script attached to the room
327
+ // (uploaded+activated via console or POST /v1/game/:appID/scripts).
328
+ // Required for onTick / onPlayerJoin / onAction etc. to fire.
326
329
  metadata: { map: 'forest' } // Optional: Custom metadata
327
330
  })
328
331
  ```