socket-function 0.159.0 → 0.161.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/index.d.ts +2573 -365
- package/package.json +1 -1
- package/require/require.d.ts +1 -1
- package/require/require.ts +1 -1
- package/src/src.d.ts +43 -0
- package/src/webSocketServer.ts +3 -0
package/package.json
CHANGED
package/require/require.d.ts
CHANGED
package/require/require.ts
CHANGED
package/src/src.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference path="./node_modules/typenode/index.d.ts" />
|
|
2
|
+
|
|
3
|
+
export { };
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
namespace NodeJS {
|
|
7
|
+
interface Module {
|
|
8
|
+
original?: SerializedModule;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
interface SerializedModule {
|
|
12
|
+
originalId: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
// If a module is not allowed clientside it is likely requests will be empty,
|
|
15
|
+
// to save effort parsing requests for modules that only exist to give better
|
|
16
|
+
// error messages.
|
|
17
|
+
requests: {
|
|
18
|
+
// request => resolvedPath
|
|
19
|
+
[request: string]: string;
|
|
20
|
+
};
|
|
21
|
+
asyncRequests: { [request: string]: true };
|
|
22
|
+
// NOTE: IF !allowclient && !serveronly, it might just mean we didn't add allowclient
|
|
23
|
+
// to the module yet. BUT, if serveronly, then we know for sure we don't want it client.
|
|
24
|
+
// So the messages and behavior will be different.
|
|
25
|
+
allowclient?: boolean;
|
|
26
|
+
serveronly?: boolean;
|
|
27
|
+
// Just for errors mostly
|
|
28
|
+
alwayssend?: boolean;
|
|
29
|
+
|
|
30
|
+
/** Only set if allowclient. */
|
|
31
|
+
source?: string;
|
|
32
|
+
|
|
33
|
+
seqNum: number;
|
|
34
|
+
|
|
35
|
+
size?: number;
|
|
36
|
+
version?: number;
|
|
37
|
+
|
|
38
|
+
flags?: {
|
|
39
|
+
[flag: string]: true;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
package/src/webSocketServer.ts
CHANGED
|
@@ -255,6 +255,9 @@ export async function startSocketServer(
|
|
|
255
255
|
// we pipe. This should be very efficient, as pipe has insane throughput
|
|
256
256
|
// (100s of MB/s, easily, even on a terrible machine).
|
|
257
257
|
socket.once("data", buffer => {
|
|
258
|
+
if (typeof buffer === "string") {
|
|
259
|
+
buffer = Buffer.from(buffer);
|
|
260
|
+
}
|
|
258
261
|
buffers.push(buffer);
|
|
259
262
|
let result = handleTLSHello(Buffer.concat(buffers), buffers.length);
|
|
260
263
|
if (result === "more") {
|