buzzk 1.4.0 โ 1.5.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/README.md +6 -10
- package/lib/chat.js +35 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,20 +17,19 @@
|
|
|
17
17
|
|
|
18
18
|
## ๐ ์
๋ฐ์ดํธ ๋ด์ญ
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
20
|
+
- ์ฑํ
์ฐฝ ์ฐ๊ฒฐ์ด ๋๊ธฐ๋ ๋ฌธ์ ํด๊ฒฐ (Ping ์ถ๊ฐ)
|
|
21
|
+
- ์ฑํ
์ฐฝ ID ๋ณ๊ฒฝ ์ ์ฌ์ฐ๊ฒฐ ๊ตฌํ
|
|
22
22
|
|
|
23
|
-
>
|
|
23
|
+
>
|
|
24
24
|
|
|
25
|
+
- onDisconnect ํจ์ ์ถ๊ฐ
|
|
26
|
+
- ์ฑํ
์ ์ฐ๊ฒฐํ์ง ๋ชปํ๋ ๋ฌธ์ ํด๊ฒฐ (UID๋ฅผ ์ ๊ฑธ๋ก ํด๋จ๋... ๋น๊ตฌ...)
|
|
25
27
|
- ํจ์ ์ด๋ฆ ์์
|
|
26
28
|
|
|
27
29
|
**ํ๋จ์ 1.3.0 ๋ง์ด๊ทธ๋ ์ด์
๊ฐ์ด๋ ์ฐธ๊ณ **
|
|
28
30
|
|
|
29
31
|
- channelID๋ก ์ฑ๋ ์ ๋ณด ๊ฐ์ ธ์ค๊ธฐ ํจ์ ์ถ๊ฐ
|
|
30
32
|
- ws ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ข
์์ฑ ์ถ๊ฐ
|
|
31
|
-
|
|
32
|
-
>
|
|
33
|
-
|
|
34
33
|
- ์๋์์ฑ ๊ธฐ๋ฅ ์ง์
|
|
35
34
|
- ํ๋ก์ฐ / ์ธํ๋ก์ฐ ๊ธฐ๋ฅ ์ถ๊ฐ
|
|
36
35
|
- live.getLiveDetail์ Return ๊ฐ์ chatLimit ์ถ๊ฐ (ํ๋ก์ฐ ๋์ ์ฑํ
๋ฑ...)
|
|
@@ -138,10 +137,7 @@
|
|
|
138
137
|
});
|
|
139
138
|
|
|
140
139
|
chat.onDisconnect(async () => { //์ฑํ
์ฐฝ ์ฐ๊ฒฐ์ด ๋๊ฒผ์ ๋
|
|
141
|
-
|
|
142
|
-
chat = new buzzkChat(channel.channelID);
|
|
143
|
-
await chat.connect();
|
|
144
|
-
//๋ค์ ์์ฑ ํ ์ฐ๊ฒฐ or liveStatus ํ์ธ ํ ๋ฐฉ์ก์ค์ด๋ฉด ์ฐ๊ฒฐ
|
|
140
|
+
//TODO
|
|
145
141
|
});
|
|
146
142
|
|
|
147
143
|
}
|
package/lib/chat.js
CHANGED
|
@@ -18,6 +18,7 @@ class chzzkChat {
|
|
|
18
18
|
#chatID;
|
|
19
19
|
|
|
20
20
|
#pollingStatus = false;
|
|
21
|
+
#pingStatus = false;
|
|
21
22
|
//Private
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -106,7 +107,10 @@ class chzzkChat {
|
|
|
106
107
|
//Ping Pong
|
|
107
108
|
|
|
108
109
|
//Connected
|
|
109
|
-
else if (data.cmd == 10100)
|
|
110
|
+
else if (data.cmd == 10100) {
|
|
111
|
+
if (!this.#pingStatus) this.#ping();
|
|
112
|
+
resolve(true);
|
|
113
|
+
}
|
|
110
114
|
//Connected
|
|
111
115
|
});
|
|
112
116
|
//WS Message
|
|
@@ -296,12 +300,40 @@ class chzzkChat {
|
|
|
296
300
|
|
|
297
301
|
//Get ChatID
|
|
298
302
|
let cidRes = await getStatus(this.channelID);
|
|
299
|
-
|
|
303
|
+
if (cidRes.chatID && cidRes.chatID != this.#chatID) {
|
|
304
|
+
this.#chatID = cidRes.chatID;
|
|
305
|
+
|
|
306
|
+
//Reconnect
|
|
307
|
+
this.#pollingStatus = false;
|
|
308
|
+
await this.disconnect();
|
|
309
|
+
await this.connect();
|
|
310
|
+
return;
|
|
311
|
+
//Reconnect
|
|
312
|
+
}
|
|
300
313
|
//Get ChatID
|
|
301
314
|
|
|
315
|
+
let interval;
|
|
316
|
+
if (cidRes.polling && cidRes.polling.callPeriodMilliSecond) interval = cidRes.polling.callPeriodMilliSecond;
|
|
317
|
+
else interval = 10000;
|
|
318
|
+
|
|
302
319
|
setTimeout(() => {
|
|
303
320
|
return this.#polling();
|
|
304
|
-
},
|
|
321
|
+
}, interval);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
async #ping () {
|
|
325
|
+
if (!this.#ws) return this.#pingStatus = false;
|
|
326
|
+
this.#pingStatus = true;
|
|
327
|
+
|
|
328
|
+
let pingOpt = {
|
|
329
|
+
"ver": "2",
|
|
330
|
+
"cmd": 0
|
|
331
|
+
};
|
|
332
|
+
this.#ws.send(JSON.stringify(pingOpt));
|
|
333
|
+
|
|
334
|
+
setTimeout(() => {
|
|
335
|
+
return this.#ping();
|
|
336
|
+
}, 20000);
|
|
305
337
|
}
|
|
306
338
|
}
|
|
307
339
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buzzk",
|
|
3
3
|
"displayName": "BUZZK",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"description": "๋ฟ์ง์ง (BUZZK) - ์น์ง์ง(CHZZK) ์ฑ๋ด์ ๋์ฑ ์ฝ๊ฒ ๊ฐ๋ฐํ ์ ์๋๋ก ๋๋ ๋น๊ณต์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ.",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"type": "commonjs",
|