/nextjs-socketio-chat

Realtime Chat App in Next.js and Socket.io

Primary LanguageTypeScript

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.

Getting Started

  1. Clone this repo and cd into it

  2. Install dependencies:

npm install
# or
yarn install
  1. Run the development server:
npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

How it works

Open multiple browser windows and start a chat to see it in action.

Caveats

This example doesn't run in a serverless environment. A running server instance is still needed.

Check a DEMO

Check the code and test this example in Codesandbox