apteryxxyz / next-ws

Add support for WebSockets in Next.js app directory.
https://npmjs.com/next-ws
171 stars 12 forks source link

Server not run #22

Closed duchuy2707 closed 7 months ago

duchuy2707 commented 7 months ago

hi Apteryx

import * as ws from 'ws';

export function SOCKET(
  client: ws.WebSocket,
) {
  console.clear();
  console.log('\n--------\n', 'A client connected!', '\n--------\n');

  client.on('message', message => {
    client.send(message);
  });

  client.on('close', () => {
    console.log('A client disconnected!');
  });
}

I've tried to test as in the example to create a socket server like the code snippet below, but it seems it's not working. No console logs are appearing, and it seems like the code isn't being called. I'm using "next": "13.4.19" with app routes.

If you have time, could you assist me, please? Thank you very much, and I wish you good health.

apteryxxyz commented 7 months ago

next-ws does not support next@13.4.19, you need <=13.4.12 or >=13.5.1.

duchuy2707 commented 7 months ago

hi @apteryxxyz thank you for support <3