This is a simple realtime chat example that demonstrates how to setup a Socket.io server in Next.js as an API route end-point.
-
Clone this repo and
cd
into it -
Install dependencies:
npm install
# or
yarn install
- Run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
Open multiple browser windows and start a chat to see it in action.
This example doesn't run in a serverless environment. A running server instance is still needed.
Check the code and test this example in Codesandbox