@laplace.live/ws 7.1.9 → 7.1.10
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/dist/browser.d.ts +6 -7
- package/dist/browser.js +2155 -2135
- package/dist/index.d.ts +38 -34
- package/dist/index.js +212 -444
- package/dist/ws-DHkTB1_n.d.ts +312 -0
- package/dist/ws-DfVxzRDM.js +426 -0
- package/package.json +7 -6
- package/dist/ws-mjTot1Nb.d.ts +0 -301
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { BilibiliInternal } from '@laplace.live/internal';
|
|
1
|
+
import { a as LiveOptions, c as LiveEventMap, i as Live, l as Inflates, n as WSOptions, o as LaplaceEventTarget, r as KeepLive, s as LaplaceRawEvent, t as LiveWSBase } from "./ws-DHkTB1_n.js";
|
|
2
|
+
import { Socket } from "node:net";
|
|
3
|
+
import { BilibiliInternal } from "@laplace.live/internal";
|
|
5
4
|
|
|
5
|
+
//#region src/tcp.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Configuration options for TCP-based live connections.
|
|
8
8
|
* Extends {@link LiveOptions} with optional host and port overrides.
|
|
9
9
|
*/
|
|
10
10
|
type TCPOptions = LiveOptions & {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** TCP server port. Defaults to `2243`. */
|
|
14
|
-
port?: number;
|
|
11
|
+
/** TCP server hostname. Defaults to `broadcastlv.chat.bilibili.com`. */host?: string; /** TCP server port. Defaults to `2243`. */
|
|
12
|
+
port?: number;
|
|
15
13
|
};
|
|
16
14
|
/**
|
|
17
15
|
* TCP transport for Bilibili live room connections.
|
|
@@ -27,22 +25,27 @@ type TCPOptions = LiveOptions & {
|
|
|
27
25
|
* @param options - TCP host/port and authentication options.
|
|
28
26
|
*/
|
|
29
27
|
declare class LiveTCPBase extends Live {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
/** The underlying Node.js TCP socket. */
|
|
29
|
+
socket: Socket;
|
|
30
|
+
/** @internal Accumulator for incomplete packets from the TCP stream. */
|
|
31
|
+
buf: Buffer;
|
|
32
|
+
/** @internal Counter for periodic buffer compaction. */
|
|
33
|
+
i: number;
|
|
34
|
+
constructor(inflates: Inflates, roomid: number, {
|
|
35
|
+
host,
|
|
36
|
+
port,
|
|
37
|
+
...options
|
|
38
|
+
}?: TCPOptions);
|
|
39
|
+
/**
|
|
40
|
+
* Extract complete packets from the internal buffer and dispatch them
|
|
41
|
+
* as `message` events. Compacts the buffer periodically to avoid
|
|
42
|
+
* unbounded memory growth from `Buffer.concat` / `slice` chains.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
splitBuffer(): void;
|
|
44
46
|
}
|
|
45
|
-
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/extra.d.ts
|
|
46
49
|
/**
|
|
47
50
|
* Fetch WebSocket connection configuration for a Bilibili live room directly
|
|
48
51
|
* from the Bilibili API (`getDanmuInfo`).
|
|
@@ -61,10 +64,10 @@ declare class LiveTCPBase extends Live {
|
|
|
61
64
|
* @throws {Error} If the API returns no data (e.g. invalid room or risk-control block).
|
|
62
65
|
*/
|
|
63
66
|
declare const getConf: (roomid: number) => Promise<{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
key: string;
|
|
68
|
+
host: string;
|
|
69
|
+
address: string;
|
|
70
|
+
json: BilibiliInternal.HTTPS.Prod.GetDanmuInfo;
|
|
68
71
|
}>;
|
|
69
72
|
/**
|
|
70
73
|
* Resolve a short (vanity) room ID to its real numeric room ID via the
|
|
@@ -77,7 +80,8 @@ declare const getConf: (roomid: number) => Promise<{
|
|
|
77
80
|
* @returns The canonical numeric room ID.
|
|
78
81
|
*/
|
|
79
82
|
declare const getRoomid: (short: number) => Promise<any>;
|
|
80
|
-
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/index.d.ts
|
|
81
85
|
/**
|
|
82
86
|
* WebSocket client for a Bilibili live room (Node.js / Bun).
|
|
83
87
|
*
|
|
@@ -95,7 +99,7 @@ declare const getRoomid: (short: number) => Promise<any>;
|
|
|
95
99
|
* ```
|
|
96
100
|
*/
|
|
97
101
|
declare class LiveWS extends LiveWSBase {
|
|
98
|
-
|
|
102
|
+
constructor(roomid: number, opts?: WSOptions);
|
|
99
103
|
}
|
|
100
104
|
/**
|
|
101
105
|
* TCP client for a Bilibili live room (Node.js / Bun only).
|
|
@@ -115,7 +119,7 @@ declare class LiveWS extends LiveWSBase {
|
|
|
115
119
|
* ```
|
|
116
120
|
*/
|
|
117
121
|
declare class LiveTCP extends LiveTCPBase {
|
|
118
|
-
|
|
122
|
+
constructor(roomid: number, opts?: TCPOptions);
|
|
119
123
|
}
|
|
120
124
|
/**
|
|
121
125
|
* Auto-reconnecting WebSocket client for a Bilibili live room
|
|
@@ -137,7 +141,7 @@ declare class LiveTCP extends LiveTCPBase {
|
|
|
137
141
|
* ```
|
|
138
142
|
*/
|
|
139
143
|
declare class KeepLiveWS extends KeepLive<LiveWSBase> {
|
|
140
|
-
|
|
144
|
+
constructor(roomid: number, opts?: WSOptions);
|
|
141
145
|
}
|
|
142
146
|
/**
|
|
143
147
|
* Auto-reconnecting TCP client for a Bilibili live room
|
|
@@ -159,7 +163,7 @@ declare class KeepLiveWS extends KeepLive<LiveWSBase> {
|
|
|
159
163
|
* ```
|
|
160
164
|
*/
|
|
161
165
|
declare class KeepLiveTCP extends KeepLive<LiveTCPBase> {
|
|
162
|
-
|
|
166
|
+
constructor(roomid: number, opts?: TCPOptions);
|
|
163
167
|
}
|
|
164
|
-
|
|
165
|
-
export { KeepLiveTCP, KeepLiveWS, LiveOptions, LiveTCP, LiveWS, type TCPOptions, WSOptions, getConf, getRoomid };
|
|
168
|
+
//#endregion
|
|
169
|
+
export { KeepLiveTCP, KeepLiveWS, LaplaceEventTarget, LaplaceRawEvent, type LiveEventMap, type LiveOptions, LiveTCP, LiveWS, type TCPOptions, type WSOptions, getConf, getRoomid };
|