socket-function 0.73.0 → 0.75.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/SocketFunction.ts +12 -0
- package/package.json +1 -1
- package/src/callManager.ts +2 -2
- package/src/webSocketServer.ts +1 -1
- package/time/trueTimeShim.ts +0 -1
package/SocketFunction.ts
CHANGED
|
@@ -419,6 +419,9 @@ export class SocketFunction {
|
|
|
419
419
|
if (isNode()) {
|
|
420
420
|
throw new Error("Cannot get browser nodeId on server");
|
|
421
421
|
}
|
|
422
|
+
if (globalThis.BOOTED_EDGE_NODE) {
|
|
423
|
+
return globalThis.BOOTED_EDGE_NODE.host;
|
|
424
|
+
}
|
|
422
425
|
return SocketFunction.connect({ address: location.hostname, port: +location.port || 443 });
|
|
423
426
|
}
|
|
424
427
|
|
|
@@ -431,6 +434,15 @@ export class SocketFunction {
|
|
|
431
434
|
}
|
|
432
435
|
|
|
433
436
|
|
|
437
|
+
declare global {
|
|
438
|
+
var BOOTED_EDGE_NODE: EdgeNodeConfig | undefined;
|
|
439
|
+
}
|
|
440
|
+
type EdgeNodeConfig = {
|
|
441
|
+
// EX: 127-0-0-1.example.com:3334
|
|
442
|
+
host: string;
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
|
|
434
446
|
let socketContextSeqNum = 1;
|
|
435
447
|
|
|
436
448
|
export function _setSocketContext<T>(
|
package/package.json
CHANGED
package/src/callManager.ts
CHANGED
|
@@ -148,7 +148,7 @@ export const runClientHooks = measureWrap(async function runClientHooks(
|
|
|
148
148
|
let time = Date.now();
|
|
149
149
|
await hook(context);
|
|
150
150
|
time = Date.now() - time;
|
|
151
|
-
if (time >
|
|
151
|
+
if (time > 500) {
|
|
152
152
|
console.warn(`Slow (${formatTime(time)}) client hook: ${JSON.stringify(hook.name || hook.toString().slice(0, 100))} for ${callType.classGuid}.${callType.functionName}(...)`);
|
|
153
153
|
}
|
|
154
154
|
// NOTE: See ClientHookContext.overrideResult for why we break here
|
|
@@ -170,7 +170,7 @@ export const runServerHooks = measureWrap(async function runServerHooks(
|
|
|
170
170
|
let time = Date.now();
|
|
171
171
|
await _setSocketContext(caller, () => hook(hookContext));
|
|
172
172
|
time = Date.now() - time;
|
|
173
|
-
if (time >
|
|
173
|
+
if (time > 500) {
|
|
174
174
|
console.warn(`Slow (${formatTime(time)}) server hook: ${JSON.stringify(hook.name || hook.toString().slice(0, 100))} for ${callType.classGuid}.${callType.functionName}(...)`);
|
|
175
175
|
}
|
|
176
176
|
// NOTE: See HookContext.overrideResult for why we don't break here
|
package/src/webSocketServer.ts
CHANGED
|
@@ -208,7 +208,7 @@ export async function startSocketServer(
|
|
|
208
208
|
}
|
|
209
209
|
let sni = data.extensions.filter(x => x.type === SNIType).flatMap(x => parseSNIExtension(x.data))[0];
|
|
210
210
|
if (!SocketFunction.silent) {
|
|
211
|
-
console.log(`Received TCP connection with SNI ${JSON.stringify(sni)}`);
|
|
211
|
+
console.log(`Received TCP connection with SNI ${JSON.stringify(sni)}. Have handlers for: ${Array.from(sniServers.keys()).join(", ")}`);
|
|
212
212
|
}
|
|
213
213
|
if (!sni) {
|
|
214
214
|
console.warn(`No SNI found in TLS hello from ${debug}, using main server. Packets ${packetCount}`);
|