@fluojs/socket.io 1.0.0-beta.1 → 1.0.0-beta.2
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/README.ko.md +10 -0
- package/README.md +10 -0
- package/package.json +7 -7
package/README.ko.md
CHANGED
|
@@ -58,6 +58,13 @@ this.rooms.joinRoom(socket.id, 'room:123');
|
|
|
58
58
|
this.rooms.broadcastToRoom('room:123', 'event', data);
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
Room helper는 공유 `WebSocketRoomService` 계약을 따르면서 Socket.IO namespace 인식을 추가합니다. gateway handler 안에서는 현재 `@WebSocketGateway({ path })` namespace를 자동으로 추론합니다. gateway handler 밖에서 room helper를 실행할 때는 같은 이름의 room이 다른 Socket.IO namespace에 존재할 수 있으므로 대상 namespace path를 명시적으로 전달하세요.
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
this.rooms.broadcastToRoom('room:123', 'event', data, '/chat');
|
|
65
|
+
this.rooms.joinRoom(socketId, 'room:123', '/chat');
|
|
66
|
+
```
|
|
67
|
+
|
|
61
68
|
### Raw Socket.IO 서버 접근
|
|
62
69
|
|
|
63
70
|
```ts
|
|
@@ -109,6 +116,8 @@ Socket.IO 등록은 소유 모듈의 import 경로에서 구성하여 namespace/
|
|
|
109
116
|
- `SocketIoModule.forRoot({ auth, cors, engine, ... })`
|
|
110
117
|
- `SOCKETIO_SERVER`
|
|
111
118
|
- `SOCKETIO_ROOM_SERVICE`
|
|
119
|
+
- `SocketIoRoomService`: 공유 room 계약에 Socket.IO namespace-aware `joinRoom`, `leaveRoom`, `broadcastToRoom`, `getRooms` helper를 더한 타입입니다.
|
|
120
|
+
- `SocketIoLifecycleService`: server와 room-service token 뒤에서 동작하는 lifecycle 기반 구현입니다. 애플리케이션 코드는 일반적으로 `SOCKETIO_SERVER` 또는 `SOCKETIO_ROOM_SERVICE`를 주입하세요.
|
|
112
121
|
|
|
113
122
|
## 지원 플랫폼
|
|
114
123
|
|
|
@@ -122,3 +131,4 @@ Socket.IO 등록은 소유 모듈의 import 경로에서 구성하여 namespace/
|
|
|
122
131
|
## 예제 소스
|
|
123
132
|
|
|
124
133
|
- `packages/socket.io/src/module.test.ts`
|
|
134
|
+
- `packages/socket.io/src/public-surface.test.ts`
|
package/README.md
CHANGED
|
@@ -59,6 +59,13 @@ this.rooms.joinRoom(socket.id, 'room:123');
|
|
|
59
59
|
this.rooms.broadcastToRoom('room:123', 'event', data);
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
Room helpers follow the shared `WebSocketRoomService` contract and add Socket.IO namespace awareness. Inside a gateway handler the current `@WebSocketGateway({ path })` namespace is inferred automatically. When room helpers run outside gateway handler context, pass the namespace path explicitly so room operations target the intended Socket.IO namespace instead of a same-named room elsewhere.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
this.rooms.broadcastToRoom('room:123', 'event', data, '/chat');
|
|
66
|
+
this.rooms.joinRoom(socketId, 'room:123', '/chat');
|
|
67
|
+
```
|
|
68
|
+
|
|
62
69
|
### Accessing the Raw Server
|
|
63
70
|
You can inject the underlying Socket.IO `Server` instance for low-level control.
|
|
64
71
|
|
|
@@ -111,6 +118,8 @@ Register Socket.IO through module imports in the owning module so namespace/mess
|
|
|
111
118
|
- `SocketIoModule.forRoot({ auth, cors, engine, ... })`: Configures namespace/message guards plus explicit CORS and Engine.IO payload bounds.
|
|
112
119
|
- `SOCKETIO_SERVER`: Token to inject the raw Socket.IO `Server`.
|
|
113
120
|
- `SOCKETIO_ROOM_SERVICE`: Token to inject the `SocketIoRoomService`.
|
|
121
|
+
- `SocketIoRoomService`: Shared room contract plus Socket.IO namespace-aware `joinRoom`, `leaveRoom`, `broadcastToRoom`, and `getRooms` helpers.
|
|
122
|
+
- `SocketIoLifecycleService`: Lifecycle-backed implementation behind the server and room-service tokens; application code should usually inject `SOCKETIO_SERVER` or `SOCKETIO_ROOM_SERVICE` instead.
|
|
114
123
|
|
|
115
124
|
## Supported Platforms
|
|
116
125
|
|
|
@@ -124,3 +133,4 @@ Register Socket.IO through module imports in the owning module so namespace/mess
|
|
|
124
133
|
## Example Sources
|
|
125
134
|
|
|
126
135
|
- `packages/socket.io/src/module.test.ts`
|
|
136
|
+
- `packages/socket.io/src/public-surface.test.ts`
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"realtime",
|
|
10
10
|
"platform"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.0-beta.
|
|
12
|
+
"version": "1.0.0-beta.2",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@socket.io/bun-engine": "^0.1.0",
|
|
40
40
|
"@fluojs/core": "^1.0.0-beta.1",
|
|
41
|
-
"@fluojs/
|
|
41
|
+
"@fluojs/di": "^1.0.0-beta.2",
|
|
42
42
|
"@fluojs/http": "^1.0.0-beta.1",
|
|
43
|
-
"@fluojs/
|
|
44
|
-
"@fluojs/
|
|
43
|
+
"@fluojs/runtime": "^1.0.0-beta.2",
|
|
44
|
+
"@fluojs/websockets": "^1.0.0-beta.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"socket.io": "^4.0.0"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"socket.io": "^4.8.1",
|
|
51
51
|
"socket.io-client": "^4.8.1",
|
|
52
52
|
"vitest": "^3.2.4",
|
|
53
|
-
"@fluojs/platform-express": "^1.0.0-beta.
|
|
54
|
-
"@fluojs/platform-fastify": "^1.0.0-beta.
|
|
55
|
-
"@fluojs/platform-nodejs": "^1.0.0-beta.
|
|
53
|
+
"@fluojs/platform-express": "^1.0.0-beta.2",
|
|
54
|
+
"@fluojs/platform-fastify": "^1.0.0-beta.3",
|
|
55
|
+
"@fluojs/platform-nodejs": "^1.0.0-beta.2"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"prebuild": "node ../../tooling/scripts/clean-dist.mjs",
|