socket-function 0.101.0 → 0.102.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/package.json +1 -1
- package/src/webSocketServer.ts +6 -2
package/package.json
CHANGED
package/src/webSocketServer.ts
CHANGED
|
@@ -80,7 +80,8 @@ export async function startSocketServer(
|
|
|
80
80
|
};
|
|
81
81
|
if (!httpsServerLast) {
|
|
82
82
|
httpsServerLast = https.createServer(lastOptions);
|
|
83
|
-
//
|
|
83
|
+
// NOTE: This MIGHT be different than the keep alive option? Probably not, but also...
|
|
84
|
+
// something weird is happening with connections...
|
|
84
85
|
httpsServerLast.keepAliveTimeout = 0;
|
|
85
86
|
} else {
|
|
86
87
|
httpsServerLast.setSecureContext(lastOptions);
|
|
@@ -167,6 +168,8 @@ export async function startSocketServer(
|
|
|
167
168
|
// our websockets, so... we really don't need to keep alive our HTTP requests
|
|
168
169
|
// (and our images go through cloudflare, so we don't even need keep alive for that)
|
|
169
170
|
keepAlive: false,
|
|
171
|
+
keepAliveInitialDelay: 0,
|
|
172
|
+
noDelay: true,
|
|
170
173
|
};
|
|
171
174
|
if (!config.cert) {
|
|
172
175
|
throw new Error("No cert specified");
|
|
@@ -181,7 +184,7 @@ export async function startSocketServer(
|
|
|
181
184
|
sniServers.set(domain, await setupHTTPSServer(obj));
|
|
182
185
|
}
|
|
183
186
|
|
|
184
|
-
let httpServer = http.createServer({}, async function (req, res) {
|
|
187
|
+
let httpServer = http.createServer({ keepAlive: false, }, async function (req, res) {
|
|
185
188
|
let url = new URL("http://" + req.headers.host + req.url);
|
|
186
189
|
url.protocol = "https:";
|
|
187
190
|
//url.hostname = opts.hostname;
|
|
@@ -189,6 +192,7 @@ export async function startSocketServer(
|
|
|
189
192
|
res.writeHead(301, { Location: url + "" });
|
|
190
193
|
res.end();
|
|
191
194
|
});
|
|
195
|
+
httpServer.keepAliveTimeout = 0;
|
|
192
196
|
httpServer.on("error", e => {
|
|
193
197
|
console.error(`HTTP error ${e.stack}`);
|
|
194
198
|
});
|