next-ws 1.0.1-canary.1 → 1.0.1-experimental.1
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
CHANGED
|
@@ -14,15 +14,16 @@ exports.CustomHttpServer = Symbol('NextWS::CustomHttpServer');
|
|
|
14
14
|
* @returns The HTTP Server instance.
|
|
15
15
|
*/
|
|
16
16
|
function useHttpServer(nextServer) {
|
|
17
|
+
// NextNodeServer is always required, so check for it before attempting to use custom server
|
|
18
|
+
if (!nextServer || !(nextServer instanceof next_server_1.default)) {
|
|
19
|
+
Log.error('[next-ws] could not find the NextNodeServer instance');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
17
22
|
const existing = Reflect.get(globalThis, exports.CustomHttpServer);
|
|
18
23
|
if (existing) {
|
|
19
24
|
Log.warnOnce('[next-ws] is using a custom HTTP Server, this is experimental and may not work as expected');
|
|
20
25
|
return existing;
|
|
21
26
|
}
|
|
22
|
-
if (!nextServer || !(nextServer instanceof next_server_1.default)) {
|
|
23
|
-
Log.error('[next-ws] could not find the NextNodeServer instance');
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
27
|
// @ts-expect-error - serverOptions is protected
|
|
27
28
|
const httpServer = nextServer.serverOptions?.httpServer;
|
|
28
29
|
if (!httpServer || !(httpServer instanceof node_http_1.Server)) {
|