next-ws 0.2.5 → 0.2.6

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
2
  <h1><strong>Next WS</strong></h1>
3
3
  <i>Add support for WebSockets in Next.js 13 app directory</i><br>
4
- <code>npm install next-ws</code>
4
+ <code>npm install next-ws ws</code>
5
5
  </div>
6
6
 
7
7
  <div align="center">
@@ -19,7 +19,9 @@
19
19
 
20
20
  Next WS (`next-ws`) is an advanced Next.js **13** plugin designed to seamlessly integrate WebSocket server functionality into API routes within the **app directory**. With Next WS, you no longer require a separate server for WebSocket functionality.
21
21
 
22
- It's important to note that this module can only be used when working with a server. Unfortunately, in serverless environments like Vercel, WebSocket servers cannot be used. Additionally, this module was built for the app directory and is incompatible with the older pages directory.
22
+ > The last supported version of Next.js is 13.4.12, read more [here](https://github.com/apteryxxyz/next-ws/issues/6).
23
+
24
+ It's **important** to note that this module can only be used when working with a server. Unfortunately, in serverless environments like Vercel, WebSocket servers cannot be used. Additionally, this module was built for the app directory and is incompatible with the older pages directory.
23
25
 
24
26
  Next WS is still pre its 1.0 release, and as such, things may change. If you find any bugs or have any suggestions, please open an issue on the GitHub repository.
25
27
 
@@ -53,7 +55,8 @@ npx next-ws-cli@latest patch
53
55
  Once the patch is complete, you will need to install the Next WS package into your project.
54
56
 
55
57
  ```sh
56
- npm install next-ws
58
+ npm install next-ws ws
59
+ # ws is a peer dependency, you must install it as well
57
60
  ```
58
61
 
59
62
  ### 🚓 Verify Patch (Optional)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-ws",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Add support for WebSockets in Next.js 13 app directory",
5
5
  "keywords": [
6
6
  "next",
package/server/setup.js CHANGED
@@ -25,7 +25,7 @@ function setupWebSocketServer(nextServer) {
25
25
  Log.error(`[next-ws] could not find module for page ${pathname}`);
26
26
  return socket.destroy();
27
27
  }
28
- const socketHandler = pageModule?.routeModule?.userload?.SOCKET;
28
+ const socketHandler = pageModule?.routeModule?.userland?.SOCKET;
29
29
  if (!socketHandler || typeof socketHandler !== 'function') {
30
30
  Log.error(`[next-ws] ${pathname} does not export a SOCKET handler`);
31
31
  return socket.destroy();
@@ -24,7 +24,7 @@ export declare function resolvePathname(nextServer: NextNodeServer, pathname: st
24
24
  export declare function getPageModule(nextServer: NextNodeServer, filename: string): Promise<PageModule>;
25
25
  export interface PageModule {
26
26
  routeModule?: {
27
- userload?: {
27
+ userland?: {
28
28
  SOCKET?: SocketHandler;
29
29
  };
30
30
  };
@@ -27,11 +27,11 @@ exports.getPatch = getPatch;
27
27
  function verifyPatch() {
28
28
  const patch = getPatch();
29
29
  if (!patch)
30
- throw new Error('Next.js has not been patched to support Next WS, please run `npx next-ws-cli patch`');
30
+ throw new Error('Next.js has not been patched to support Next WS, please run `npx next-ws-cli@latest patch`');
31
31
  // eslint-disable-next-line @typescript-eslint/no-var-requires
32
32
  const packageJson = require('next/package.json');
33
33
  const version = packageJson.version.split('-')[0];
34
34
  if (patch.version !== version)
35
- throw new Error(`Next.js version mismatch, expected ${patch.version} but found ${version}, try running \`npx next-ws-cli patch\``);
35
+ throw new Error(`Next.js version mismatch, expected ${patch.version} but found ${version}, try running \`npx next-ws-cli@latest patch\``);
36
36
  }
37
37
  exports.verifyPatch = verifyPatch;