diff --git a/playground/node/test.ts b/playground/node/test.ts index c4d87a4..9230a12 100644 --- a/playground/node/test.ts +++ b/playground/node/test.ts @@ -8,6 +8,10 @@ const res = await getLongRoomId(process.env.VITE_ROOM as any) const live = new KeepLiveTCP(res.data.room_id) +live.on('open', () => console.log('连接成功')) + +live.on('close', () => console.log('断开连接')) + live.on('SEND_GIFT', (message) => { // 有礼物, 但不会被触发 console.log(message) }) diff --git a/playground/package.json b/playground/package.json index cdf23b8..2e7a9a1 100644 --- a/playground/package.json +++ b/playground/package.json @@ -7,7 +7,7 @@ "dev": "vite", "build": "vue-tsc --noEmit && vite build", "preview": "vite preview", - "dev:node": "esno ./node/test.ts" + "dev:node": "tsx ./node/test.ts" }, "dependencies": { "tiny-bilibili-ws": "workspace:*", diff --git a/playground/src/App.vue b/playground/src/App.vue index e0b1648..4477dce 100644 --- a/playground/src/App.vue +++ b/playground/src/App.vue @@ -1,10 +1,17 @@ - 1 + + {{ JSON.stringify(m.data) }} +